summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/migrate/017_create_settings.rb1
-rw-r--r--db/migrate/20250530185658_ensure_wiki_tablesort_setting_is_stored_in_db.rb8
-rw-r--r--db/migrate/20250611092155_create_doorkeeper_tables.rb68
-rw-r--r--db/migrate/20250611092227_enable_pkce.rb8
4 files changed, 85 insertions, 0 deletions
diff --git a/db/migrate/017_create_settings.rb b/db/migrate/017_create_settings.rb
index 5768ca24c..f86a1c2c3 100644
--- a/db/migrate/017_create_settings.rb
+++ b/db/migrate/017_create_settings.rb
@@ -8,6 +8,7 @@ class CreateSettings < ActiveRecord::Migration[4.2]
# Persist default settings for new installations
Setting.create!(name: 'default_notification_option', value: Setting.default_notification_option)
Setting.create!(name: 'text_formatting', value: Setting.text_formatting)
+ Setting.create!(name: 'wiki_tablesort_enabled', value: Setting.wiki_tablesort_enabled)
end
def self.down
diff --git a/db/migrate/20250530185658_ensure_wiki_tablesort_setting_is_stored_in_db.rb b/db/migrate/20250530185658_ensure_wiki_tablesort_setting_is_stored_in_db.rb
new file mode 100644
index 000000000..b64a42dbb
--- /dev/null
+++ b/db/migrate/20250530185658_ensure_wiki_tablesort_setting_is_stored_in_db.rb
@@ -0,0 +1,8 @@
+class EnsureWikiTablesortSettingIsStoredInDb < ActiveRecord::Migration[7.2]
+ def change
+ unless Setting.where(name: "wiki_tablesort_enabled").exists?
+ setting = Setting.new(:name => "wiki_tablesort_enabled", :value => 1)
+ setting.save!
+ end
+ end
+end
diff --git a/db/migrate/20250611092155_create_doorkeeper_tables.rb b/db/migrate/20250611092155_create_doorkeeper_tables.rb
new file mode 100644
index 000000000..9e8096be3
--- /dev/null
+++ b/db/migrate/20250611092155_create_doorkeeper_tables.rb
@@ -0,0 +1,68 @@
+class CreateDoorkeeperTables < ActiveRecord::Migration[7.2]
+ def change
+ create_table :oauth_applications do |t|
+ t.string :name, null: false
+ t.string :uid, null: false
+ t.string :secret, null: false
+ t.text :redirect_uri, null: false
+ t.text :scopes, null: false
+ t.boolean :confidential, null: false, default: true
+ t.timestamps null: false
+ end
+
+ add_index :oauth_applications, :uid, unique: true
+
+ create_table :oauth_access_grants do |t|
+ t.integer :resource_owner_id, null: false
+ t.references :application, null: false
+ t.string :token, null: false
+ t.integer :expires_in, null: false
+ t.text :redirect_uri, null: false
+ t.datetime :created_at, null: false
+ t.datetime :revoked_at
+ t.text :scopes
+ end
+
+ add_index :oauth_access_grants, :token, unique: true
+ add_foreign_key(
+ :oauth_access_grants,
+ :oauth_applications,
+ column: :application_id
+ )
+ add_foreign_key(
+ :oauth_access_grants,
+ :users,
+ column: :resource_owner_id
+ )
+
+ create_table :oauth_access_tokens do |t|
+ t.integer :resource_owner_id
+ t.references :application
+
+ t.string :token, null: false
+
+ t.string :refresh_token
+ t.integer :expires_in
+ t.datetime :revoked_at
+ t.datetime :created_at, null: false
+ t.text :scopes
+
+ t.string :previous_refresh_token, null: false, default: ""
+ end
+
+ add_index :oauth_access_tokens, :token, unique: true
+ add_index :oauth_access_tokens, :resource_owner_id
+ add_index :oauth_access_tokens, :refresh_token, unique: true
+
+ add_foreign_key(
+ :oauth_access_tokens,
+ :oauth_applications,
+ column: :application_id
+ )
+ add_foreign_key(
+ :oauth_access_tokens,
+ :users,
+ column: :resource_owner_id
+ )
+ end
+end
diff --git a/db/migrate/20250611092227_enable_pkce.rb b/db/migrate/20250611092227_enable_pkce.rb
new file mode 100644
index 000000000..cfc666f50
--- /dev/null
+++ b/db/migrate/20250611092227_enable_pkce.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+class EnablePkce < ActiveRecord::Migration[7.2]
+ def change
+ add_column :oauth_access_grants, :code_challenge, :string, null: true
+ add_column :oauth_access_grants, :code_challenge_method, :string, null: true
+ end
+end