aboutsummaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2011-01-31 15:00:27 +0100
committerHeiko Bernloehr <Heiko.Bernloehr@FreeIT.de>2011-01-31 15:00:27 +0100
commit6e5a780ba6ca83fd68267b0cc40f8943eb267827 (patch)
tree2f3aa64f2a1382284eedb6be71811d7dcb52470c /db
downloadecs2-6e5a780ba6ca83fd68267b0cc40f8943eb267827.tar.gz
ecs2-6e5a780ba6ca83fd68267b0cc40f8943eb267827.zip
Initial commit.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20091006133635_create_sessions.rb34
-rw-r--r--db/migrate/20100121203546_create_participants.rb37
-rw-r--r--db/migrate/20100121205728_create_communities.rb32
-rw-r--r--db/migrate/20100121205935_create_memberships.rb32
-rw-r--r--db/migrate/20100121210405_create_organizations.rb33
-rw-r--r--db/migrate/20100131022034_create_identities.rb33
-rw-r--r--db/migrate/20100205192422_create_messages.rb34
-rw-r--r--db/migrate/20100205192757_create_membership_messages.rb32
-rw-r--r--db/migrate/20100406115338_create_ressources.rb32
-rw-r--r--db/migrate/20100425195021_add_monitor_to_message.rb34
-rw-r--r--db/migrate/20100802084408_create_ressource_monitors.rb33
-rw-r--r--db/migrate/20100802085027_remove_columns_from_message.rb29
-rw-r--r--db/migrate/20100922104919_rename_touch_from_ressource_monitors.rb27
-rw-r--r--db/migrate/20101109101215_create_ev_types.rb31
-rw-r--r--db/migrate/20101109141511_create_events.rb33
-rw-r--r--db/migrate/20101117081838_add_lock_version_to_membership_messages.rb27
-rw-r--r--db/migrate/20101118104211_add_lock_version_to_event.rb27
-rw-r--r--db/migrate/20101119114524_add_removed_to_messages.rb27
-rw-r--r--db/migrate/20101119114704_add_events_to_ressources.rb27
-rw-r--r--db/migrate/20101220150806_add_community_selfrouting_to_participants.rb27
-rw-r--r--db/migrate/20101223102836_create_community_messages.rb32
-rw-r--r--db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb27
-rw-r--r--db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb27
-rw-r--r--db/schema.rb124
-rw-r--r--db/seeds.rb31
25 files changed, 862 insertions, 0 deletions
diff --git a/db/migrate/20091006133635_create_sessions.rb b/db/migrate/20091006133635_create_sessions.rb
new file mode 100644
index 0000000..e9f4c11
--- /dev/null
+++ b/db/migrate/20091006133635_create_sessions.rb
@@ -0,0 +1,34 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateSessions < ActiveRecord::Migration
+ def self.up
+ create_table :sessions do |t|
+ t.string :session_id, :null => false
+ t.text :data
+ t.timestamps
+ end
+
+ add_index :sessions, :session_id
+ add_index :sessions, :updated_at
+ end
+
+ def self.down
+ drop_table :sessions
+ end
+end
diff --git a/db/migrate/20100121203546_create_participants.rb b/db/migrate/20100121203546_create_participants.rb
new file mode 100644
index 0000000..1b4d0f0
--- /dev/null
+++ b/db/migrate/20100121203546_create_participants.rb
@@ -0,0 +1,37 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateParticipants < ActiveRecord::Migration
+ def self.up
+ create_table :participants do |t|
+ t.string :name
+ t.string :dns
+ t.string :email
+ t.text :description
+ t.integer :organization_id
+ t.datetime :ttl, :null => true, :default => nil
+ t.boolean :anonymous, :null => false, :default => false
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :participants
+ end
+end
diff --git a/db/migrate/20100121205728_create_communities.rb b/db/migrate/20100121205728_create_communities.rb
new file mode 100644
index 0000000..dc566d8
--- /dev/null
+++ b/db/migrate/20100121205728_create_communities.rb
@@ -0,0 +1,32 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateCommunities < ActiveRecord::Migration
+ def self.up
+ create_table :communities do |t|
+ t.string :name
+ t.text :description
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :communities
+ end
+end
diff --git a/db/migrate/20100121205935_create_memberships.rb b/db/migrate/20100121205935_create_memberships.rb
new file mode 100644
index 0000000..9c09ec6
--- /dev/null
+++ b/db/migrate/20100121205935_create_memberships.rb
@@ -0,0 +1,32 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateMemberships < ActiveRecord::Migration
+ def self.up
+ create_table :memberships do |t|
+ t.integer :participant_id
+ t.integer :community_id
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :memberships
+ end
+end
diff --git a/db/migrate/20100121210405_create_organizations.rb b/db/migrate/20100121210405_create_organizations.rb
new file mode 100644
index 0000000..515c2b1
--- /dev/null
+++ b/db/migrate/20100121210405_create_organizations.rb
@@ -0,0 +1,33 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateOrganizations < ActiveRecord::Migration
+ def self.up
+ create_table :organizations do |t|
+ t.string :name
+ t.text :description
+ t.string :abrev
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :organizations
+ end
+end
diff --git a/db/migrate/20100131022034_create_identities.rb b/db/migrate/20100131022034_create_identities.rb
new file mode 100644
index 0000000..5d533ab
--- /dev/null
+++ b/db/migrate/20100131022034_create_identities.rb
@@ -0,0 +1,33 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateIdentities < ActiveRecord::Migration
+ def self.up
+ create_table :identities do |t|
+ t.integer :participant_id
+ t.string :name
+ t.text :description
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :identities
+ end
+end
diff --git a/db/migrate/20100205192422_create_messages.rb b/db/migrate/20100205192422_create_messages.rb
new file mode 100644
index 0000000..8f7541f
--- /dev/null
+++ b/db/migrate/20100205192422_create_messages.rb
@@ -0,0 +1,34 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateMessages < ActiveRecord::Migration
+ def self.up
+ create_table :messages do |t|
+ t.string :content_type, :x_ecs_receiver_communities, :x_ecs_receiver_memberships, :null => true, :default => nil
+ t.integer :sender, :null => true, :default => nil
+ t.text :body, :null => true, :default => nil
+
+ t.integer :ressource_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :messages
+ end
+end
diff --git a/db/migrate/20100205192757_create_membership_messages.rb b/db/migrate/20100205192757_create_membership_messages.rb
new file mode 100644
index 0000000..c062f76
--- /dev/null
+++ b/db/migrate/20100205192757_create_membership_messages.rb
@@ -0,0 +1,32 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateMembershipMessages < ActiveRecord::Migration
+ def self.up
+ create_table :membership_messages do |t|
+ t.integer :membership_id
+ t.integer :message_id
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :membership_messages
+ end
+end
diff --git a/db/migrate/20100406115338_create_ressources.rb b/db/migrate/20100406115338_create_ressources.rb
new file mode 100644
index 0000000..3e14de3
--- /dev/null
+++ b/db/migrate/20100406115338_create_ressources.rb
@@ -0,0 +1,32 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateRessources < ActiveRecord::Migration
+ def self.up
+ create_table :ressources do |t|
+ t.string :namespace, :ressource, :null => true, :default => nil
+ t.boolean :postroute, :null => true, :default => false
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :ressources
+ end
+end
diff --git a/db/migrate/20100425195021_add_monitor_to_message.rb b/db/migrate/20100425195021_add_monitor_to_message.rb
new file mode 100644
index 0000000..81d4282
--- /dev/null
+++ b/db/migrate/20100425195021_add_monitor_to_message.rb
@@ -0,0 +1,34 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddMonitorToMessage < ActiveRecord::Migration
+ def self.up
+ add_column :messages, :lock_version, :integer, :default => 0
+ add_column :messages, :monitor, :integer, :default => 0
+ #Message.all.each do |m|
+ # m.lock_version = 0
+ # m.monitor = false
+ # m.save
+ #end
+ end
+
+ def self.down
+ remove_column :messages, :monitor
+ remove_column :messages, :lock_version
+ end
+end
diff --git a/db/migrate/20100802084408_create_ressource_monitors.rb b/db/migrate/20100802084408_create_ressource_monitors.rb
new file mode 100644
index 0000000..62c09a2
--- /dev/null
+++ b/db/migrate/20100802084408_create_ressource_monitors.rb
@@ -0,0 +1,33 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateRessourceMonitors < ActiveRecord::Migration
+ def self.up
+ create_table :ressource_monitors do |t|
+ t.integer :lock_version, :default => 0
+ t.integer :touch, :default => 0
+ t.string :name
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :ressource_monitors
+ end
+end
diff --git a/db/migrate/20100802085027_remove_columns_from_message.rb b/db/migrate/20100802085027_remove_columns_from_message.rb
new file mode 100644
index 0000000..573ed66
--- /dev/null
+++ b/db/migrate/20100802085027_remove_columns_from_message.rb
@@ -0,0 +1,29 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 RemoveColumnsFromMessage < ActiveRecord::Migration
+ def self.up
+ remove_column :messages, :lock_version
+ remove_column :messages, :monitor
+ end
+
+ def self.down
+ add_column :messages, :monitor, :integer
+ add_column :messages, :lock_version, :integer
+ end
+end
diff --git a/db/migrate/20100922104919_rename_touch_from_ressource_monitors.rb b/db/migrate/20100922104919_rename_touch_from_ressource_monitors.rb
new file mode 100644
index 0000000..829eea7
--- /dev/null
+++ b/db/migrate/20100922104919_rename_touch_from_ressource_monitors.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 RenameTouchFromRessourceMonitors < ActiveRecord::Migration
+ def self.up
+ rename_column :ressource_monitors, :touch, :monitor_counter
+ end
+
+ def self.down
+ raise ActiveRecord::IrreversibleMigration
+ end
+end
diff --git a/db/migrate/20101109101215_create_ev_types.rb b/db/migrate/20101109101215_create_ev_types.rb
new file mode 100644
index 0000000..caa5b64
--- /dev/null
+++ b/db/migrate/20101109101215_create_ev_types.rb
@@ -0,0 +1,31 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateEvTypes < ActiveRecord::Migration
+ def self.up
+ create_table :ev_types do |t|
+ t.string :name
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :ev_types
+ end
+end
diff --git a/db/migrate/20101109141511_create_events.rb b/db/migrate/20101109141511_create_events.rb
new file mode 100644
index 0000000..64f49d5
--- /dev/null
+++ b/db/migrate/20101109141511_create_events.rb
@@ -0,0 +1,33 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateEvents < ActiveRecord::Migration
+ def self.up
+ create_table :events do |t|
+ t.integer :participant_id
+ t.integer :message_id
+ t.integer :ev_type_id
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :events
+ end
+end
diff --git a/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb b/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb
new file mode 100644
index 0000000..b4d103a
--- /dev/null
+++ b/db/migrate/20101117081838_add_lock_version_to_membership_messages.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddLockVersionToMembershipMessages < ActiveRecord::Migration
+ def self.up
+ add_column :membership_messages, :lock_version, :integer, :default => 0
+ end
+
+ def self.down
+ remove_column :membership_messages, :lock_version
+ end
+end
diff --git a/db/migrate/20101118104211_add_lock_version_to_event.rb b/db/migrate/20101118104211_add_lock_version_to_event.rb
new file mode 100644
index 0000000..eb18998
--- /dev/null
+++ b/db/migrate/20101118104211_add_lock_version_to_event.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddLockVersionToEvent < ActiveRecord::Migration
+ def self.up
+ add_column :events, :lock_version, :integer, :default => 0
+ end
+
+ def self.down
+ remove_column :events, :lock_version
+ end
+end
diff --git a/db/migrate/20101119114524_add_removed_to_messages.rb b/db/migrate/20101119114524_add_removed_to_messages.rb
new file mode 100644
index 0000000..006ae5f
--- /dev/null
+++ b/db/migrate/20101119114524_add_removed_to_messages.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddRemovedToMessages < ActiveRecord::Migration
+ def self.up
+ add_column :messages, :removed, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :messages, :removed
+ end
+end
diff --git a/db/migrate/20101119114704_add_events_to_ressources.rb b/db/migrate/20101119114704_add_events_to_ressources.rb
new file mode 100644
index 0000000..87629b5
--- /dev/null
+++ b/db/migrate/20101119114704_add_events_to_ressources.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddEventsToRessources < ActiveRecord::Migration
+ def self.up
+ add_column :ressources, :events, :boolean, :default => true
+ end
+
+ def self.down
+ remove_column :ressources, :events
+ end
+end
diff --git a/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb b/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb
new file mode 100644
index 0000000..53ec402
--- /dev/null
+++ b/db/migrate/20101220150806_add_community_selfrouting_to_participants.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 AddCommunitySelfroutingToParticipants < ActiveRecord::Migration
+ def self.up
+ add_column :participants, :community_selfrouting, :boolean, :default => false
+ end
+
+ def self.down
+ remove_column :participants, :community_selfrouting
+ end
+end
diff --git a/db/migrate/20101223102836_create_community_messages.rb b/db/migrate/20101223102836_create_community_messages.rb
new file mode 100644
index 0000000..9b3326a
--- /dev/null
+++ b/db/migrate/20101223102836_create_community_messages.rb
@@ -0,0 +1,32 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 CreateCommunityMessages < ActiveRecord::Migration
+ def self.up
+ create_table :community_messages do |t|
+ t.integer :community_id
+ t.integer :message_id
+
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :community_messages
+ end
+end
diff --git a/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb b/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb
new file mode 100644
index 0000000..5144181
--- /dev/null
+++ b/db/migrate/20110103143940_remove_xecsreceivercommunities_from_message.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 RemoveXecsreceivercommunitiesFromMessage < ActiveRecord::Migration
+ def self.up
+ remove_column :messages, :x_ecs_receiver_communities
+ end
+
+ def self.down
+ add_column :messages, :x_ecs_receiver_communities
+ end
+end
diff --git a/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb b/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb
new file mode 100644
index 0000000..e31b347
--- /dev/null
+++ b/db/migrate/20110103145840_remove_xecsreceivermemberships_from_message.rb
@@ -0,0 +1,27 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# 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 RemoveXecsreceivermembershipsFromMessage < ActiveRecord::Migration
+ def self.up
+ remove_column :messages, :x_ecs_receiver_memberships
+ end
+
+ def self.down
+ add_column :messages, :x_ecs_receiver_memberships
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
new file mode 100644
index 0000000..40fccd3
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,124 @@
+# This file is auto-generated from the current state of the database. Instead of editing this file,
+# please use the migrations feature of Active Record to incrementally modify your database, and
+# then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your database schema. If you need
+# to create the application database on another system, you should be using db:schema:load, not running
+# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20110103145840) do
+
+ create_table "communities", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "community_messages", :force => true do |t|
+ t.integer "community_id"
+ t.integer "message_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "ev_types", :force => true do |t|
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "events", :force => true do |t|
+ t.integer "participant_id"
+ t.integer "message_id"
+ t.integer "ev_type_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "lock_version", :default => 0
+ end
+
+ create_table "identities", :force => true do |t|
+ t.integer "participant_id"
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "membership_messages", :force => true do |t|
+ t.integer "membership_id"
+ t.integer "message_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "lock_version", :default => 0
+ end
+
+ create_table "memberships", :force => true do |t|
+ t.integer "participant_id"
+ t.integer "community_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "messages", :force => true do |t|
+ t.string "content_type"
+ t.integer "sender"
+ t.text "body"
+ t.integer "ressource_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "removed", :default => false
+ end
+
+ create_table "organizations", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.string "abrev"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "participants", :force => true do |t|
+ t.string "name"
+ t.string "dns"
+ t.string "email"
+ t.text "description"
+ t.integer "organization_id"
+ t.datetime "ttl"
+ t.boolean "anonymous", :default => false, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.boolean "community_selfrouting", :default => false
+ end
+
+ create_table "ressource_monitors", :force => true do |t|
+ t.integer "lock_version", :default => 0
+ t.integer "monitor_counter", :default => 0
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "ressources", :force => true 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", :force => true do |t|
+ t.string "session_id", :null => false
+ t.text "data"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
+ add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
+
+end
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 0000000..a49fc81
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1,31 @@
+# Copyright (C) 2007, 2008, 2009, 2010 Heiko Bernloehr (FreeIT.de).
+#
+# This file is part of ECS.
+#
+# ECS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# ECS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with ECS. If not, see <http://www.gnu.org/licenses/>.
+
+
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
+#
+# Examples:
+#
+# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
+# Major.create(:name => 'Daley', :city => cities.first)
+Organization.create :name => "not available", :description => "For anonymous participants.", :abrev => "n/a"
+Community.create :name => "public", :description => "For anonymous participants."
+RessourceMonitor.create :name => "queue"
+%w(created destroyed updated notlinked).each do |evt|
+ EvType.create :name => evt
+end