Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2017-09-21 00:52:58 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2017-09-29 00:04:34 +0300
commit28d32719332dcdd037112d7904311336f9b5b4e8 (patch)
treef2891a4f0377a55c59f1b8e4b43e01268ab3b1e7 /db
parent35711606e419a96d18ab849e017ed72bd702a3c3 (diff)
Create refereces model
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20170920214158_create_references_table.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/db/migrate/20170920214158_create_references_table.rb b/db/migrate/20170920214158_create_references_table.rb
new file mode 100644
index 000000000..75ce6c109
--- /dev/null
+++ b/db/migrate/20170920214158_create_references_table.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class CreateReferencesTable < ActiveRecord::Migration[5.1]
+ def change
+ create_table :references do |t|
+ t.integer :source_id, null: false
+ t.string :source_type, limit: 60, null: false
+ t.integer :target_id, null: false
+ t.string :target_type, limit: 60, null: false
+ end
+
+ add_index :references, %i[source_id source_type target_id target_type],
+ name: :index_references_on_source_and_target, unique: true
+ add_index :references, %i[source_id source_type], name: :index_references_on_source_id_and_source_type
+ end
+end