summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2022-09-23 00:24:05 +0200
committerHeiko Bernlöhr <Heiko.Bernloehr@FreeIT.de>2022-09-23 00:24:05 +0200
commitb3890cf85795e81d066c13d2436985654ee60bf7 (patch)
treea0460ed9afb82c71c9ef919c1f78ba8b434691cd
parentccdad359bd0d489861dec4e040da0e60f499aff0 (diff)
downloadecs-b3890cf85795e81d066c13d2436985654ee60bf7.tar.gz
ecs-b3890cf85795e81d066c13d2436985654ee60bf7.zip
Fix sqlite3 regressionv2.0.1
Rebuilding schema file now (new rails version) discards "id: :serial" in create_table statement. Otherwise sqlite3 failed when seeding data with an "not null" exception for "id" (primary key).
-rw-r--r--db/migrate/20091006133635_create_sessions.rb2
-rw-r--r--db/migrate/20100121203546_create_participants.rb2
-rw-r--r--db/migrate/20100121205728_create_communities.rb2
-rw-r--r--db/migrate/20100121205935_create_memberships.rb2
-rw-r--r--db/migrate/20100121210405_create_organizations.rb2
-rw-r--r--db/migrate/20100131022034_create_identities.rb2
-rw-r--r--db/migrate/20100205192422_create_messages.rb2
-rw-r--r--db/migrate/20100205192757_create_membership_messages.rb2
-rw-r--r--db/migrate/20100406115338_create_ressources.rb2
-rw-r--r--db/migrate/20100425195021_add_monitor_to_message.rb2
-rw-r--r--db/migrate/20100802085027_remove_columns_from_message.rb2
-rw-r--r--db/migrate/20101109101215_create_ev_types.rb2
-rw-r--r--db/migrate/20101109141511_create_events.rb2
-rw-r--r--db/migrate/20101117081838_add_lock_version_to_membership_messages.rb2
-rw-r--r--db/migrate/20101118104211_add_lock_version_to_event.rb2
-rw-r--r--db/migrate/20101119114524_add_removed_to_messages.rb2
-rw-r--r--db/migrate/20101119114704_add_events_to_ressources.rb2
-rw-r--r--db/migrate/20101220150806_add_community_selfrouting_to_participants.rb2
-rw-r--r--db/migrate/20101223102836_create_community_messages.rb2
-rw-r--r--db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb2
-rw-r--r--db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb2
-rw-r--r--db/migrate/20110303145153_create_auths.rb2
-rw-r--r--db/migrate/20130813144307_add_events_to_participant.rb2
-rw-r--r--db/migrate/20140525164346_create_subparticipants.rb2
-rw-r--r--db/migrate/20150420210728_add_ptype_to_participants.rb2
-rw-r--r--db/migrate/20180228115558_add_index_to_events.rb2
-rw-r--r--db/migrate/20180228115911_add_index_to_membership_messages.rb2
-rw-r--r--db/schema.rb65
28 files changed, 54 insertions, 65 deletions
diff --git a/db/migrate/20091006133635_create_sessions.rb b/db/migrate/20091006133635_create_sessions.rb
index e9f4c11..175c4ed 100644
--- a/db/migrate/20091006133635_create_sessions.rb
+++ b/db/migrate/20091006133635_create_sessions.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateSessions < ActiveRecord::Migration
+class CreateSessions < ActiveRecord::Migration[4.2]
def self.up
create_table :sessions do |t|
t.string :session_id, :null => false
diff --git a/db/migrate/20100121203546_create_participants.rb b/db/migrate/20100121203546_create_participants.rb
index 1b4d0f0..43fd7a8 100644
--- a/db/migrate/20100121203546_create_participants.rb
+++ b/db/migrate/20100121203546_create_participants.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateParticipants < ActiveRecord::Migration
+class CreateParticipants < ActiveRecord::Migration[4.2]
def self.up
create_table :participants do |t|
t.string :name
diff --git a/db/migrate/20100121205728_create_communities.rb b/db/migrate/20100121205728_create_communities.rb
index dc566d8..d49803f 100644
--- a/db/migrate/20100121205728_create_communities.rb
+++ b/db/migrate/20100121205728_create_communities.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateCommunities < ActiveRecord::Migration
+class CreateCommunities < ActiveRecord::Migration[4.2]
def self.up
create_table :communities do |t|
t.string :name
diff --git a/db/migrate/20100121205935_create_memberships.rb b/db/migrate/20100121205935_create_memberships.rb
index 9c09ec6..02ee2c2 100644
--- a/db/migrate/20100121205935_create_memberships.rb
+++ b/db/migrate/20100121205935_create_memberships.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateMemberships < ActiveRecord::Migration
+class CreateMemberships < ActiveRecord::Migration[4.2]
def self.up
create_table :memberships do |t|
t.integer :participant_id
diff --git a/db/migrate/20100121210405_create_organizations.rb b/db/migrate/20100121210405_create_organizations.rb
index 515c2b1..4009e33 100644
--- a/db/migrate/20100121210405_create_organizations.rb
+++ b/db/migrate/20100121210405_create_organizations.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateOrganizations < ActiveRecord::Migration
+class CreateOrganizations < ActiveRecord::Migration[4.2]
def self.up
create_table :organizations do |t|
t.string :name
diff --git a/db/migrate/20100131022034_create_identities.rb b/db/migrate/20100131022034_create_identities.rb
index 5d533ab..de5d600 100644
--- a/db/migrate/20100131022034_create_identities.rb
+++ b/db/migrate/20100131022034_create_identities.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateIdentities < ActiveRecord::Migration
+class CreateIdentities < ActiveRecord::Migration[4.2]
def self.up
create_table :identities do |t|
t.integer :participant_id
diff --git a/db/migrate/20100205192422_create_messages.rb b/db/migrate/20100205192422_create_messages.rb
index 8f7541f..49866c8 100644
--- a/db/migrate/20100205192422_create_messages.rb
+++ b/db/migrate/20100205192422_create_messages.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateMessages < ActiveRecord::Migration
+class CreateMessages < ActiveRecord::Migration[4.2]
def self.up
create_table :messages do |t|
t.string :content_type, :x_ecs_receiver_communities, :x_ecs_receiver_memberships, :null => true, :default => nil
diff --git a/db/migrate/20100205192757_create_membership_messages.rb b/db/migrate/20100205192757_create_membership_messages.rb
index c062f76..78ea0b6 100644
--- a/db/migrate/20100205192757_create_membership_messages.rb
+++ b/db/migrate/20100205192757_create_membership_messages.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateMembershipMessages < ActiveRecord::Migration
+class CreateMembershipMessages < ActiveRecord::Migration[4.2]
def self.up
create_table :membership_messages do |t|
t.integer :membership_id
diff --git a/db/migrate/20100406115338_create_ressources.rb b/db/migrate/20100406115338_create_ressources.rb
index 3e14de3..a945135 100644
--- a/db/migrate/20100406115338_create_ressources.rb
+++ b/db/migrate/20100406115338_create_ressources.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateRessources < ActiveRecord::Migration
+class CreateRessources < ActiveRecord::Migration[4.2]
def self.up
create_table :ressources do |t|
t.string :namespace, :ressource, :null => true, :default => nil
diff --git a/db/migrate/20100425195021_add_monitor_to_message.rb b/db/migrate/20100425195021_add_monitor_to_message.rb
index 81d4282..d8f6792 100644
--- a/db/migrate/20100425195021_add_monitor_to_message.rb
+++ b/db/migrate/20100425195021_add_monitor_to_message.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddMonitorToMessage < ActiveRecord::Migration
+class AddMonitorToMessage < ActiveRecord::Migration[4.2]
def self.up
add_column :messages, :lock_version, :integer, :default => 0
add_column :messages, :monitor, :integer, :default => 0
diff --git a/db/migrate/20100802085027_remove_columns_from_message.rb b/db/migrate/20100802085027_remove_columns_from_message.rb
index 573ed66..3204d07 100644
--- a/db/migrate/20100802085027_remove_columns_from_message.rb
+++ b/db/migrate/20100802085027_remove_columns_from_message.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class RemoveColumnsFromMessage < ActiveRecord::Migration
+class RemoveColumnsFromMessage < ActiveRecord::Migration[4.2]
def self.up
remove_column :messages, :lock_version
remove_column :messages, :monitor
diff --git a/db/migrate/20101109101215_create_ev_types.rb b/db/migrate/20101109101215_create_ev_types.rb
index caa5b64..e7bef84 100644
--- a/db/migrate/20101109101215_create_ev_types.rb
+++ b/db/migrate/20101109101215_create_ev_types.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateEvTypes < ActiveRecord::Migration
+class CreateEvTypes < ActiveRecord::Migration[4.2]
def self.up
create_table :ev_types do |t|
t.string :name
diff --git a/db/migrate/20101109141511_create_events.rb b/db/migrate/20101109141511_create_events.rb
index 64f49d5..b037406 100644
--- a/db/migrate/20101109141511_create_events.rb
+++ b/db/migrate/20101109141511_create_events.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateEvents < ActiveRecord::Migration
+class CreateEvents < ActiveRecord::Migration[4.2]
def self.up
create_table :events do |t|
t.integer :participant_id
diff --git a/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb b/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb
index b4d103a..b45b1ea 100644
--- a/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb
+++ b/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddLockVersionToMembershipMessages < ActiveRecord::Migration
+class AddLockVersionToMembershipMessages < ActiveRecord::Migration[4.2]
def self.up
add_column :membership_messages, :lock_version, :integer, :default => 0
end
diff --git a/db/migrate/20101118104211_add_lock_version_to_event.rb b/db/migrate/20101118104211_add_lock_version_to_event.rb
index eb18998..5339dc4 100644
--- a/db/migrate/20101118104211_add_lock_version_to_event.rb
+++ b/db/migrate/20101118104211_add_lock_version_to_event.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddLockVersionToEvent < ActiveRecord::Migration
+class AddLockVersionToEvent < ActiveRecord::Migration[4.2]
def self.up
add_column :events, :lock_version, :integer, :default => 0
end
diff --git a/db/migrate/20101119114524_add_removed_to_messages.rb b/db/migrate/20101119114524_add_removed_to_messages.rb
index 006ae5f..a741f31 100644
--- a/db/migrate/20101119114524_add_removed_to_messages.rb
+++ b/db/migrate/20101119114524_add_removed_to_messages.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddRemovedToMessages < ActiveRecord::Migration
+class AddRemovedToMessages < ActiveRecord::Migration[4.2]
def self.up
add_column :messages, :removed, :boolean, :default => false
end
diff --git a/db/migrate/20101119114704_add_events_to_ressources.rb b/db/migrate/20101119114704_add_events_to_ressources.rb
index 87629b5..a4b778f 100644
--- a/db/migrate/20101119114704_add_events_to_ressources.rb
+++ b/db/migrate/20101119114704_add_events_to_ressources.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddEventsToRessources < ActiveRecord::Migration
+class AddEventsToRessources < ActiveRecord::Migration[4.2]
def self.up
add_column :ressources, :events, :boolean, :default => true
end
diff --git a/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb b/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb
index 53ec402..8599f90 100644
--- a/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb
+++ b/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class AddCommunitySelfroutingToParticipants < ActiveRecord::Migration
+class AddCommunitySelfroutingToParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :community_selfrouting, :boolean, :default => false
end
diff --git a/db/migrate/20101223102836_create_community_messages.rb b/db/migrate/20101223102836_create_community_messages.rb
index 9b3326a..3d22535 100644
--- a/db/migrate/20101223102836_create_community_messages.rb
+++ b/db/migrate/20101223102836_create_community_messages.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateCommunityMessages < ActiveRecord::Migration
+class CreateCommunityMessages < ActiveRecord::Migration[4.2]
def self.up
create_table :community_messages do |t|
t.integer :community_id
diff --git a/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb b/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb
index 5144181..1832998 100644
--- a/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb
+++ b/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class RemoveXecsreceivercommunitiesFromMessage < ActiveRecord::Migration
+class RemoveXecsreceivercommunitiesFromMessage < ActiveRecord::Migration[4.2]
def self.up
remove_column :messages, :x_ecs_receiver_communities
end
diff --git a/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb b/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb
index e31b347..7c211de 100644
--- a/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb
+++ b/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb
@@ -16,7 +16,7 @@
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class RemoveXecsreceivermembershipsFromMessage < ActiveRecord::Migration
+class RemoveXecsreceivermembershipsFromMessage < ActiveRecord::Migration[4.2]
def self.up
remove_column :messages, :x_ecs_receiver_memberships
end
diff --git a/db/migrate/20110303145153_create_auths.rb b/db/migrate/20110303145153_create_auths.rb
index ba3a8fb..b18e147 100644
--- a/db/migrate/20110303145153_create_auths.rb
+++ b/db/migrate/20110303145153_create_auths.rb
@@ -1,4 +1,4 @@
-class CreateAuths < ActiveRecord::Migration
+class CreateAuths < ActiveRecord::Migration[4.2]
def self.up
create_table :auths do |t|
t.string :one_touch_hash
diff --git a/db/migrate/20130813144307_add_events_to_participant.rb b/db/migrate/20130813144307_add_events_to_participant.rb
index a1dd85f..e4a9c68 100644
--- a/db/migrate/20130813144307_add_events_to_participant.rb
+++ b/db/migrate/20130813144307_add_events_to_participant.rb
@@ -1,4 +1,4 @@
-class AddEventsToParticipant < ActiveRecord::Migration
+class AddEventsToParticipant < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :events_, :boolean, :default => true
Participant.all.each do |p|
diff --git a/db/migrate/20140525164346_create_subparticipants.rb b/db/migrate/20140525164346_create_subparticipants.rb
index 6e2e49d..2b678e8 100644
--- a/db/migrate/20140525164346_create_subparticipants.rb
+++ b/db/migrate/20140525164346_create_subparticipants.rb
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU Affero General Public
# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
-class CreateSubparticipants < ActiveRecord::Migration
+class CreateSubparticipants < ActiveRecord::Migration[4.2]
def self.up
create_table :subparticipants do |t|
t.integer :participant_id
diff --git a/db/migrate/20150420210728_add_ptype_to_participants.rb b/db/migrate/20150420210728_add_ptype_to_participants.rb
index 679321a..1c43a4d 100644
--- a/db/migrate/20150420210728_add_ptype_to_participants.rb
+++ b/db/migrate/20150420210728_add_ptype_to_participants.rb
@@ -1,4 +1,4 @@
-class AddPtypeToParticipants < ActiveRecord::Migration
+class AddPtypeToParticipants < ActiveRecord::Migration[4.2]
def self.up
add_column :participants, :ptype, :string
assign_participant_type
diff --git a/db/migrate/20180228115558_add_index_to_events.rb b/db/migrate/20180228115558_add_index_to_events.rb
index b12527e..a3f4a4b 100644
--- a/db/migrate/20180228115558_add_index_to_events.rb
+++ b/db/migrate/20180228115558_add_index_to_events.rb
@@ -1,4 +1,4 @@
-class AddIndexToEvents < ActiveRecord::Migration
+class AddIndexToEvents < ActiveRecord::Migration[4.2]
def change
add_index :events, :participant_id, unique: false
add_index :events, :message_id, unique: false
diff --git a/db/migrate/20180228115911_add_index_to_membership_messages.rb b/db/migrate/20180228115911_add_index_to_membership_messages.rb
index f7e5c2f..d6179b0 100644
--- a/db/migrate/20180228115911_add_index_to_membership_messages.rb
+++ b/db/migrate/20180228115911_add_index_to_membership_messages.rb
@@ -1,4 +1,4 @@
-class AddIndexToMembershipMessages < ActiveRecord::Migration
+class AddIndexToMembershipMessages < ActiveRecord::Migration[4.2]
def change
add_index :membership_messages, :message_id, unique: false
end
diff --git a/db/schema.rb b/db/schema.rb
index f841251..dac26a6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -12,37 +12,34 @@
ActiveRecord::Schema.define(version: 2018_02_28_115911) do
- # These are extensions that must be enabled in order to support this database
- enable_extension "plpgsql"
-
- create_table "auths", id: :serial, force: :cascade do |t|
- t.string "one_touch_hash", limit: 255
+ create_table "auths", force: :cascade do |t|
+ t.string "one_touch_hash"
t.integer "message_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "communities", id: :serial, force: :cascade do |t|
- t.string "name", limit: 255
+ create_table "communities", force: :cascade do |t|
+ t.string "name"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "community_messages", id: :serial, force: :cascade do |t|
+ create_table "community_messages", force: :cascade do |t|
t.integer "community_id"
t.integer "message_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "ev_types", id: :serial, force: :cascade do |t|
- t.string "name", limit: 255
+ create_table "ev_types", force: :cascade do |t|
+ t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "events", id: :serial, force: :cascade do |t|
+ create_table "events", force: :cascade do |t|
t.integer "participant_id"
t.integer "message_id"
t.integer "ev_type_id"
@@ -53,15 +50,15 @@ ActiveRecord::Schema.define(version: 2018_02_28_115911) do
t.index ["participant_id"], name: "index_events_on_participant_id"
end
- create_table "identities", id: :serial, force: :cascade do |t|
+ create_table "identities", force: :cascade do |t|
t.integer "participant_id"
- t.string "name", limit: 255
+ t.string "name"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "membership_messages", id: :serial, force: :cascade do |t|
+ create_table "membership_messages", force: :cascade do |t|
t.integer "membership_id"
t.integer "message_id"
t.datetime "created_at"
@@ -70,15 +67,15 @@ ActiveRecord::Schema.define(version: 2018_02_28_115911) do
t.index ["message_id"], name: "index_membership_messages_on_message_id"
end
- create_table "memberships", id: :serial, force: :cascade do |t|
+ create_table "memberships", force: :cascade do |t|
t.integer "participant_id"
t.integer "community_id"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "messages", id: :serial, force: :cascade do |t|
- t.string "content_type", limit: 255
+ create_table "messages", force: :cascade do |t|
+ t.string "content_type"
t.integer "sender"
t.text "body"
t.integer "ressource_id"
@@ -87,18 +84,18 @@ ActiveRecord::Schema.define(version: 2018_02_28_115911) do
t.boolean "removed", default: false
end
- create_table "organizations", id: :serial, force: :cascade do |t|
- t.string "name", limit: 255
+ create_table "organizations", force: :cascade do |t|
+ t.string "name"
t.text "description"
- t.string "abrev", limit: 255
+ t.string "abrev"
t.datetime "created_at"
t.datetime "updated_at"
end
- create_table "participants", id: :serial, force: :cascade do |t|
- t.string "name", limit: 255
- t.string "dns", limit: 255
- t.string "email", limit: 255
+ create_table "participants", force: :cascade do |t|
+ t.string "name"
+ t.string "dns"
+ t.string "email"
t.text "description"
t.integer "organization_id"
t.datetime "ttl"
@@ -110,25 +107,17 @@ ActiveRecord::Schema.define(version: 2018_02_28_115911) do
t.string "ptype"
end
- create_table "ressource_monitors", id: :serial, force: :cascade do |t|
- t.integer "lock_version", default: 0
- t.integer "monitor_counter", default: 0
- t.string "name", limit: 255
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "ressources", id: :serial, force: :cascade do |t|
- t.string "namespace", limit: 255
- t.string "ressource", limit: 255
+ create_table "ressources", force: :cascade do |t|
+ t.string "namespace"
+ t.string "ressource"
t.boolean "postroute", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "events", default: true
end
- create_table "sessions", id: :serial, force: :cascade do |t|
- t.string "session_id", limit: 255, null: false
+ create_table "sessions", force: :cascade do |t|
+ t.string "session_id", null: false
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
@@ -136,7 +125,7 @@ ActiveRecord::Schema.define(version: 2018_02_28_115911) do
t.index ["updated_at"], name: "index_sessions_on_updated_at"
end
- create_table "subparticipants", id: :serial, force: :cascade do |t|
+ create_table "subparticipants", force: :cascade do |t|
t.integer "participant_id"
t.integer "parent_id"
t.string "realm"