mirror of
https://github.com/astuto/astuto.git
synced 2025-12-16 03:37:56 +01:00
Add API (#427)
This commit is contained in:
committed by
GitHub
parent
5ad04adb10
commit
31999a2af6
17
db/migrate/20241004170520_create_api_keys.rb
Normal file
17
db/migrate/20241004170520_create_api_keys.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateApiKeys < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
create_table :api_keys do |t|
|
||||
t.references :tenant, null: false, foreign_key: true
|
||||
t.references :user, null: false, foreign_key: true
|
||||
|
||||
t.string :common_token_prefix, null: false
|
||||
t.string :random_token_prefix, null: false
|
||||
t.string :token_digest, null: false
|
||||
|
||||
t.timestamps
|
||||
|
||||
t.index :token_digest, unique: true
|
||||
t.index [:user_id, :tenant_id], unique: true
|
||||
end
|
||||
end
|
||||
end
|
||||
18
db/schema.rb
18
db/schema.rb
@@ -10,11 +10,25 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2024_09_17_140122) do
|
||||
ActiveRecord::Schema.define(version: 2024_10_04_170520) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
create_table "api_keys", force: :cascade do |t|
|
||||
t.bigint "tenant_id", null: false
|
||||
t.bigint "user_id", null: false
|
||||
t.string "common_token_prefix", null: false
|
||||
t.string "random_token_prefix", null: false
|
||||
t.string "token_digest", null: false
|
||||
t.datetime "created_at", precision: 6, null: false
|
||||
t.datetime "updated_at", precision: 6, null: false
|
||||
t.index ["tenant_id"], name: "index_api_keys_on_tenant_id"
|
||||
t.index ["token_digest"], name: "index_api_keys_on_token_digest", unique: true
|
||||
t.index ["user_id", "tenant_id"], name: "index_api_keys_on_user_id_and_tenant_id", unique: true
|
||||
t.index ["user_id"], name: "index_api_keys_on_user_id"
|
||||
end
|
||||
|
||||
create_table "boards", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "description"
|
||||
@@ -231,6 +245,8 @@ ActiveRecord::Schema.define(version: 2024_09_17_140122) do
|
||||
t.index ["tenant_id"], name: "index_users_on_tenant_id"
|
||||
end
|
||||
|
||||
add_foreign_key "api_keys", "tenants"
|
||||
add_foreign_key "api_keys", "users"
|
||||
add_foreign_key "boards", "tenants"
|
||||
add_foreign_key "comments", "comments", column: "parent_id"
|
||||
add_foreign_key "comments", "posts"
|
||||
|
||||
Reference in New Issue
Block a user