
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Override migration methods to support UUID/ULID columns without having to be explicit about it.
$ gem install ar-sqlite-uuid
Or add the following line to your project's Gemfile:
$ bundle add ar-sqlite-uuid
Also, make sure the extension is loaded. I recommend using sqlpkg. Then you can install the extension you want to use:
$ sqlpkg install asg017/ulid
$ sqlpkg install sqlite/uuid
To load the extension into your sqlite database,
On your gemfile, you must specify which extension you want to use by loading
either ar-sqlite-uuid
or ar-sqlite-ulid
.
source "https://rubygems.org"
# This will use the `sqlite/uuid` extension.
gem "ar-sqlite-uuid"
# This will use the `asg017/ulid` extension.
gem "ar-sqlite-uuid", require: "ar-sqlite-ulid"
Alternatively, you can also manually define the function that will be used:
# file: config/initialize/active_record.rb
# use ulid
AR::UUID.default_function = "ulid()"
# use ulid with a static prefix
AR::UUID.default_function = "ulid_with_prefix('myapp')"
# use ulid with a dynamic prefix.
# By default it uses the table name, but you can override it by passing a
# `:prefix` key to `t.primary_key` or `create_table`.
AR::UUID.default_function = "ulid_with_prefix('%{prefix}')"
# use uuid
AR::UUID.default_function = "uuid()"
When you create a new table, the id
column will be defined as TEXT
, using
the defined function as the default value.
create_table :users
add_reference :posts, :users
create_table :posts do |t|
t.belongs_to :user
# or
t.references :user
end
If you need an integer column, specify the type manually.
create_table :users, do |t|
t.column :position, :bigserial, null: false
end
For more details about how to contribute, please read https://github.com/fnando/ar-sqlite-uuid/blob/main/CONTRIBUTING.md.
The gem is available as open source under the terms of the MIT License. A copy of the license can be found at https://github.com/fnando/ar-sqlite-uuid/blob/main/LICENSE.md.
Everyone interacting in the ar-sqlite-uuid project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that ar-sqlite-uuid demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.