Add chat migration
* add chat_contacts table * add chat_fragments table * add chat_enabled column to aspects * add chat_offline_messages table
This commit is contained in:
parent
aec00f834f
commit
56e882879a
5 changed files with 89 additions and 6 deletions
16
db/migrate/20140801101230_create_chat_contacts.rb
Normal file
16
db/migrate/20140801101230_create_chat_contacts.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
class CreateChatContacts < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :chat_contacts do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.string :jid, null: false
|
||||
t.string :name, limit: 255, null: true
|
||||
t.string :ask, limit: 128, null: true
|
||||
t.string :subscription, limit: 128, null: false
|
||||
end
|
||||
add_index :chat_contacts, [:user_id, :jid], unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :chat_contacts
|
||||
end
|
||||
end
|
||||
17
db/migrate/20140801101352_create_chat_fragments.rb
Normal file
17
db/migrate/20140801101352_create_chat_fragments.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class CreateChatFragments < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :chat_fragments do |t|
|
||||
t.integer :user_id, null: false
|
||||
t.string :root, limit: 256, null: false
|
||||
t.string :namespace, limit: 256, null: false
|
||||
t.text :xml, null: false
|
||||
end
|
||||
# That'll wont work due UTF-8 and the limit of 767 bytes
|
||||
#add_index :chat_fragments, [:user_id, :root, :namespace], unique: true
|
||||
add_index :chat_fragments, [:user_id], unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :chat_fragments
|
||||
end
|
||||
end
|
||||
9
db/migrate/20141007003922_add_chat_enabled_to_aspects.rb
Normal file
9
db/migrate/20141007003922_add_chat_enabled_to_aspects.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class AddChatEnabledToAspects < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_column :aspects, :chat_enabled, :boolean, default: false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :aspects, :chat_enabled
|
||||
end
|
||||
end
|
||||
14
db/migrate/20141024170120_create_chat_offline_messages.rb
Normal file
14
db/migrate/20141024170120_create_chat_offline_messages.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class CreateChatOfflineMessages < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :chat_offline_messages do |t|
|
||||
t.string :from, :null => false
|
||||
t.string :to, :null => false
|
||||
t.text :message, :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :chat_offline_messages
|
||||
end
|
||||
end
|
||||
39
db/schema.rb
39
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20141001162851) do
|
||||
ActiveRecord::Schema.define(version: 20141024170120) do
|
||||
|
||||
create_table "account_deletions", force: true do |t|
|
||||
t.string "diaspora_handle"
|
||||
|
|
@ -43,12 +43,13 @@ ActiveRecord::Schema.define(version: 20141001162851) do
|
|||
add_index "aspect_visibilities", ["shareable_id", "shareable_type"], name: "index_aspect_visibilities_on_shareable_id_and_shareable_type", using: :btree
|
||||
|
||||
create_table "aspects", force: true do |t|
|
||||
t.string "name", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "contacts_visible", default: true, null: false
|
||||
t.string "name", null: false
|
||||
t.integer "user_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.boolean "contacts_visible", default: true, null: false
|
||||
t.integer "order_id"
|
||||
t.boolean "chat_enabled", default: false
|
||||
end
|
||||
|
||||
add_index "aspects", ["user_id", "contacts_visible"], name: "index_aspects_on_user_id_and_contacts_visible", using: :btree
|
||||
|
|
@ -59,6 +60,32 @@ ActiveRecord::Schema.define(version: 20141001162851) do
|
|||
t.integer "person_id"
|
||||
end
|
||||
|
||||
create_table "chat_contacts", force: true do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "jid", null: false
|
||||
t.string "name"
|
||||
t.string "ask", limit: 128
|
||||
t.string "subscription", limit: 128, null: false
|
||||
end
|
||||
|
||||
add_index "chat_contacts", ["user_id", "jid"], name: "index_chat_contacts_on_user_id_and_jid", unique: true, using: :btree
|
||||
|
||||
create_table "chat_fragments", force: true do |t|
|
||||
t.integer "user_id", null: false
|
||||
t.string "root", limit: 256, null: false
|
||||
t.string "namespace", limit: 256, null: false
|
||||
t.text "xml", null: false
|
||||
end
|
||||
|
||||
add_index "chat_fragments", ["user_id"], name: "index_chat_fragments_on_user_id", unique: true, using: :btree
|
||||
|
||||
create_table "chat_offline_messages", force: true do |t|
|
||||
t.string "from", null: false
|
||||
t.string "to", null: false
|
||||
t.text "message", null: false
|
||||
t.datetime "created_at", null: false
|
||||
end
|
||||
|
||||
create_table "comments", force: true do |t|
|
||||
t.text "text", null: false
|
||||
t.integer "commentable_id", null: false
|
||||
|
|
|
|||
Loading…
Reference in a new issue