2012-05-28 10:41:33 +02:00
|
|
|
# encoding: UTF-8
|
|
|
|
# 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.
|
2009-01-06 11:49:19 +01:00
|
|
|
#
|
2012-05-28 10:41:33 +02:00
|
|
|
# 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
|
2009-01-06 11:49:19 +01:00
|
|
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
|
|
|
#
|
2014-02-20 15:04:53 +01:00
|
|
|
# It's strongly recommended that you check this file into your version control system.
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2019-11-11 12:09:18 +01:00
|
|
|
ActiveRecord::Schema.define(version: 20181205010000) do
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "article_categories", force: :cascade do |t|
|
|
|
|
t.string "name", limit: 255, default: "", null: false
|
|
|
|
t.string "description", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "article_categories", ["name"], name: "index_article_categories_on_name", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "article_prices", force: :cascade do |t|
|
|
|
|
t.integer "article_id", limit: 4
|
|
|
|
t.decimal "price", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.decimal "tax", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.decimal "deposit", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.integer "unit_quantity", limit: 4
|
2009-01-29 01:57:51 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "article_prices", ["article_id"], name: "index_article_prices_on_article_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "articles", force: :cascade do |t|
|
|
|
|
t.string "name", limit: 255, default: "", null: false
|
|
|
|
t.integer "supplier_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "article_category_id", limit: 4, default: 0, null: false
|
|
|
|
t.string "unit", limit: 255, default: "", null: false
|
|
|
|
t.string "note", limit: 255
|
2015-09-23 22:38:20 +02:00
|
|
|
t.boolean "availability", default: true, null: false
|
2015-02-27 17:28:50 +01:00
|
|
|
t.string "manufacturer", limit: 255
|
|
|
|
t.string "origin", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
t.datetime "shared_updated_on"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.decimal "price", precision: 8, scale: 2
|
|
|
|
t.float "tax", limit: 24
|
|
|
|
t.decimal "deposit", precision: 8, scale: 2, default: 0
|
|
|
|
t.integer "unit_quantity", limit: 4, default: 1, null: false
|
|
|
|
t.string "order_number", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2009-01-20 19:37:15 +01:00
|
|
|
t.datetime "deleted_at"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.string "type", limit: 255
|
|
|
|
t.integer "quantity", limit: 4, default: 0
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "articles", ["article_category_id"], name: "index_articles_on_article_category_id", using: :btree
|
|
|
|
add_index "articles", ["name", "supplier_id"], name: "index_articles_on_name_and_supplier_id", using: :btree
|
|
|
|
add_index "articles", ["supplier_id"], name: "index_articles_on_supplier_id", using: :btree
|
|
|
|
add_index "articles", ["type"], name: "index_articles_on_type", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "assignments", force: :cascade do |t|
|
|
|
|
t.integer "user_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "task_id", limit: 4, default: 0, null: false
|
2015-09-23 22:38:20 +02:00
|
|
|
t.boolean "accepted", default: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "assignments", ["user_id", "task_id"], name: "index_assignments_on_user_id_and_task_id", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2018-09-14 19:33:27 +02:00
|
|
|
create_table "bank_accounts", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "name", limit: 255, null: false
|
|
|
|
t.string "iban", limit: 255
|
|
|
|
t.string "description", limit: 255
|
|
|
|
t.decimal "balance", precision: 12, scale: 2, default: 0, null: false
|
2018-09-14 19:33:27 +02:00
|
|
|
t.datetime "last_import"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "import_continuation_point", limit: 255
|
2018-09-14 19:33:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "bank_transactions", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "bank_account_id", limit: 4, null: false
|
|
|
|
t.string "external_id", limit: 255
|
2018-09-14 19:33:27 +02:00
|
|
|
t.date "date"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.decimal "amount", precision: 8, scale: 2, null: false
|
|
|
|
t.string "iban", limit: 255
|
|
|
|
t.string "reference", limit: 255
|
|
|
|
t.text "text", limit: 65535
|
|
|
|
t.text "receipt", limit: 65535
|
|
|
|
t.binary "image", limit: 16777215
|
|
|
|
t.integer "financial_link_id", limit: 4
|
2018-09-14 19:33:27 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index "bank_transactions", ["financial_link_id"], name: "index_bank_transactions_on_financial_link_id", using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "deliveries", force: :cascade do |t|
|
|
|
|
t.integer "supplier_id", limit: 4
|
2009-01-13 19:01:56 +01:00
|
|
|
t.date "delivered_on"
|
|
|
|
t.datetime "created_at"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.text "note", limit: 65535
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "invoice_id", limit: 4
|
2009-01-13 19:01:56 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "deliveries", ["supplier_id"], name: "index_deliveries_on_supplier_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2017-10-11 10:18:26 +02:00
|
|
|
create_table "documents", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "name", limit: 255
|
|
|
|
t.string "mime", limit: 255
|
|
|
|
t.binary "data", limit: 4294967295
|
|
|
|
t.integer "created_by_user_id", limit: 4
|
2017-10-11 10:18:26 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "parent_id", limit: 4
|
2017-10-11 10:18:26 +02:00
|
|
|
end
|
|
|
|
|
2017-11-08 22:35:12 +01:00
|
|
|
add_index "documents", ["parent_id"], name: "index_documents_on_parent_id", using: :btree
|
|
|
|
|
2018-10-15 21:53:16 +02:00
|
|
|
create_table "financial_links", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.text "note", limit: 65535
|
2017-10-13 14:36:56 +02:00
|
|
|
end
|
|
|
|
|
2017-03-04 14:15:18 +01:00
|
|
|
create_table "financial_transaction_classes", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "name", limit: 255, null: false
|
2017-03-04 14:15:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
create_table "financial_transaction_types", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "name", limit: 255, null: false
|
|
|
|
t.integer "financial_transaction_class_id", limit: 4, null: false
|
|
|
|
t.string "name_short", limit: 255
|
2019-11-11 12:09:18 +01:00
|
|
|
t.integer "bank_account_id", limit: 4
|
2017-03-04 14:15:18 +01:00
|
|
|
end
|
|
|
|
|
2018-09-12 15:02:25 +02:00
|
|
|
add_index "financial_transaction_types", ["name_short"], name: "index_financial_transaction_types_on_name_short", using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "financial_transactions", force: :cascade do |t|
|
2019-11-01 14:07:23 +01:00
|
|
|
t.integer "ordergroup_id", limit: 4
|
2017-03-04 14:15:18 +01:00
|
|
|
t.decimal "amount", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.text "note", limit: 65535, null: false
|
|
|
|
t.integer "user_id", limit: 4, default: 0, null: false
|
|
|
|
t.datetime "created_on", null: false
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "financial_transaction_type_id", limit: 4, null: false
|
|
|
|
t.integer "financial_link_id", limit: 4
|
|
|
|
t.integer "reverts_id", limit: 4
|
2019-11-04 04:33:43 +01:00
|
|
|
t.integer "group_order_id"
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "financial_transactions", ["ordergroup_id"], name: "index_financial_transactions_on_ordergroup_id", using: :btree
|
2019-11-01 19:30:23 +01:00
|
|
|
add_index "financial_transactions", ["reverts_id"], name: "index_financial_transactions_on_reverts_id", unique: true, using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "group_order_article_quantities", force: :cascade do |t|
|
|
|
|
t.integer "group_order_article_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "quantity", limit: 4, default: 0
|
|
|
|
t.integer "tolerance", limit: 4, default: 0
|
|
|
|
t.datetime "created_on", null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "group_order_article_quantities", ["group_order_article_id"], name: "index_group_order_article_quantities_on_group_order_article_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "group_order_articles", force: :cascade do |t|
|
|
|
|
t.integer "group_order_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "order_article_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "quantity", limit: 4, default: 0, null: false
|
|
|
|
t.integer "tolerance", limit: 4, default: 0, null: false
|
|
|
|
t.datetime "updated_on", null: false
|
|
|
|
t.decimal "result", precision: 8, scale: 3
|
|
|
|
t.decimal "result_computed", precision: 8, scale: 3
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "group_order_articles", ["group_order_id", "order_article_id"], name: "goa_index", unique: true, using: :btree
|
|
|
|
add_index "group_order_articles", ["group_order_id"], name: "index_group_order_articles_on_group_order_id", using: :btree
|
|
|
|
add_index "group_order_articles", ["order_article_id"], name: "index_group_order_articles_on_order_article_id", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "group_orders", force: :cascade do |t|
|
2016-02-25 02:27:17 +01:00
|
|
|
t.integer "ordergroup_id", limit: 4
|
2015-02-27 17:28:50 +01:00
|
|
|
t.integer "order_id", limit: 4, default: 0, null: false
|
|
|
|
t.decimal "price", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.integer "lock_version", limit: 4, default: 0, null: false
|
|
|
|
t.datetime "updated_on", null: false
|
|
|
|
t.integer "updated_by_user_id", limit: 4
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "group_orders", ["order_id"], name: "index_group_orders_on_order_id", using: :btree
|
|
|
|
add_index "group_orders", ["ordergroup_id", "order_id"], name: "index_group_orders_on_ordergroup_id_and_order_id", unique: true, using: :btree
|
|
|
|
add_index "group_orders", ["ordergroup_id"], name: "index_group_orders_on_ordergroup_id", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "groups", force: :cascade do |t|
|
|
|
|
t.string "type", limit: 255, default: "", null: false
|
|
|
|
t.string "name", limit: 255, default: "", null: false
|
|
|
|
t.string "description", limit: 255
|
|
|
|
t.decimal "account_balance", precision: 12, scale: 2, default: 0, null: false
|
|
|
|
t.datetime "created_on", null: false
|
2015-09-23 22:38:20 +02:00
|
|
|
t.boolean "role_admin", default: false, null: false
|
|
|
|
t.boolean "role_suppliers", default: false, null: false
|
|
|
|
t.boolean "role_article_meta", default: false, null: false
|
|
|
|
t.boolean "role_finance", default: false, null: false
|
|
|
|
t.boolean "role_orders", default: false, null: false
|
2009-01-29 01:57:51 +01:00
|
|
|
t.datetime "deleted_at"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.string "contact_person", limit: 255
|
|
|
|
t.string "contact_phone", limit: 255
|
|
|
|
t.string "contact_address", limit: 255
|
|
|
|
t.text "stats", limit: 65535
|
|
|
|
t.integer "next_weekly_tasks_number", limit: 4, default: 8
|
2015-09-23 22:38:20 +02:00
|
|
|
t.boolean "ignore_apple_restriction", default: false
|
2016-03-04 17:07:24 +01:00
|
|
|
t.date "break_start"
|
|
|
|
t.date "break_end"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.boolean "role_invoices", default: false, null: false
|
2017-11-15 23:58:11 +01:00
|
|
|
t.boolean "role_pickups", default: false, null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "groups", ["name"], name: "index_groups_on_name", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "invites", force: :cascade do |t|
|
|
|
|
t.string "token", limit: 255, default: "", null: false
|
|
|
|
t.datetime "expires_at", null: false
|
|
|
|
t.integer "group_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "user_id", limit: 4, default: 0, null: false
|
|
|
|
t.string "email", limit: 255, default: "", null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "invites", ["token"], name: "index_invites_on_token", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "invoices", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "supplier_id", limit: 4
|
|
|
|
t.string "number", limit: 255
|
2009-01-08 16:33:27 +01:00
|
|
|
t.date "date"
|
|
|
|
t.date "paid_on"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.text "note", limit: 65535
|
|
|
|
t.decimal "amount", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.decimal "deposit", precision: 8, scale: 2, default: 0, null: false
|
|
|
|
t.decimal "deposit_credit", precision: 8, scale: 2, default: 0, null: false
|
2009-08-12 18:41:25 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "created_by_user_id", limit: 4
|
|
|
|
t.string "attachment_mime", limit: 255
|
|
|
|
t.binary "attachment_data", limit: 16777215
|
|
|
|
t.integer "financial_link_id", limit: 4
|
2009-01-08 16:33:27 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "invoices", ["supplier_id"], name: "index_invoices_on_supplier_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2020-07-29 11:19:20 +02:00
|
|
|
create_table "links", force: :cascade do |t|
|
|
|
|
t.string "name", null: false
|
|
|
|
t.string "url", null: false
|
|
|
|
t.integer "workgroup_id"
|
|
|
|
t.boolean "indirect", default: false, null: false
|
|
|
|
t.string "authorization"
|
|
|
|
end
|
|
|
|
|
2017-08-18 09:17:19 +02:00
|
|
|
create_table "mail_delivery_status", force: :cascade do |t|
|
|
|
|
t.datetime "created_at"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "email", limit: 255, null: false
|
|
|
|
t.string "message", limit: 255, null: false
|
|
|
|
t.string "attachment_mime", limit: 255
|
|
|
|
t.binary "attachment_data", limit: 4294967295
|
2017-08-18 09:17:19 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index "mail_delivery_status", ["email"], name: "index_mail_delivery_status_on_email", using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "memberships", force: :cascade do |t|
|
|
|
|
t.integer "group_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "user_id", limit: 4, default: 0, null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "memberships", ["user_id", "group_id"], name: "index_memberships_on_user_id_and_group_id", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2019-10-29 01:19:05 +01:00
|
|
|
create_table "message_recipients", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "message_id", limit: 4, null: false
|
|
|
|
t.integer "user_id", limit: 4, null: false
|
|
|
|
t.integer "email_state", limit: 4, default: 0, null: false
|
2019-10-29 01:19:05 +01:00
|
|
|
t.datetime "read_at"
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "message_recipients", ["message_id"], name: "index_message_recipients_on_message_id", using: :btree
|
|
|
|
add_index "message_recipients", ["user_id", "read_at"], name: "index_message_recipients_on_user_id_and_read_at", using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "messages", force: :cascade do |t|
|
|
|
|
t.integer "sender_id", limit: 4
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "subject", limit: 255, null: false
|
2015-02-27 17:28:50 +01:00
|
|
|
t.text "body", limit: 65535
|
2019-11-13 11:35:57 +01:00
|
|
|
t.boolean "private", default: false
|
2009-01-15 18:26:37 +01:00
|
|
|
t.datetime "created_at"
|
2015-02-26 00:11:39 +01:00
|
|
|
t.integer "reply_to", limit: 4
|
|
|
|
t.integer "group_id", limit: 4
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "salt", limit: 255
|
|
|
|
t.binary "received_email", limit: 16777215
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2018-10-13 20:16:35 +02:00
|
|
|
create_table "oauth_access_grants", force: :cascade do |t|
|
|
|
|
t.integer "resource_owner_id", limit: 4, null: false
|
|
|
|
t.integer "application_id", limit: 4, null: false
|
|
|
|
t.string "token", limit: 255, null: false
|
|
|
|
t.integer "expires_in", limit: 4, null: false
|
|
|
|
t.text "redirect_uri", limit: 65535, null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "revoked_at"
|
|
|
|
t.string "scopes", limit: 255
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
|
|
|
|
|
|
|
|
create_table "oauth_access_tokens", force: :cascade do |t|
|
|
|
|
t.integer "resource_owner_id", limit: 4
|
|
|
|
t.integer "application_id", limit: 4
|
|
|
|
t.string "token", limit: 255, null: false
|
|
|
|
t.string "refresh_token", limit: 255
|
|
|
|
t.integer "expires_in", limit: 4
|
|
|
|
t.datetime "revoked_at"
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.string "scopes", limit: 255
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
|
|
|
|
add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
|
|
|
|
add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
|
|
|
|
|
|
|
|
create_table "oauth_applications", force: :cascade do |t|
|
2018-10-13 21:53:23 +02:00
|
|
|
t.string "name", limit: 255, null: false
|
|
|
|
t.string "uid", limit: 255, null: false
|
|
|
|
t.string "secret", limit: 255, null: false
|
|
|
|
t.text "redirect_uri", limit: 65535, null: false
|
|
|
|
t.string "scopes", limit: 255, default: "", null: false
|
2018-10-13 20:16:35 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
2018-10-13 21:53:23 +02:00
|
|
|
t.boolean "confidential", default: true, null: false
|
2018-10-13 20:16:35 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "order_articles", force: :cascade do |t|
|
|
|
|
t.integer "order_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "article_id", limit: 4, default: 0, null: false
|
|
|
|
t.integer "quantity", limit: 4, default: 0, null: false
|
|
|
|
t.integer "tolerance", limit: 4, default: 0, null: false
|
|
|
|
t.integer "units_to_order", limit: 4, default: 0, null: false
|
|
|
|
t.integer "lock_version", limit: 4, default: 0, null: false
|
|
|
|
t.integer "article_price_id", limit: 4
|
|
|
|
t.integer "units_billed", limit: 4
|
|
|
|
t.integer "units_received", limit: 4
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "order_articles", ["order_id", "article_id"], name: "index_order_articles_on_order_id_and_article_id", unique: true, using: :btree
|
|
|
|
add_index "order_articles", ["order_id"], name: "index_order_articles_on_order_id", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "order_comments", force: :cascade do |t|
|
|
|
|
t.integer "order_id", limit: 4
|
|
|
|
t.integer "user_id", limit: 4
|
|
|
|
t.text "text", limit: 65535
|
2009-01-29 01:57:51 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "order_comments", ["order_id"], name: "index_order_comments_on_order_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "orders", force: :cascade do |t|
|
|
|
|
t.integer "supplier_id", limit: 4
|
|
|
|
t.text "note", limit: 65535
|
2009-01-29 01:57:51 +01:00
|
|
|
t.datetime "starts"
|
2009-01-06 11:49:19 +01:00
|
|
|
t.datetime "ends"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.string "state", limit: 255, default: "open"
|
|
|
|
t.integer "lock_version", limit: 4, default: 0, null: false
|
|
|
|
t.integer "updated_by_user_id", limit: 4
|
|
|
|
t.decimal "foodcoop_result", precision: 8, scale: 2
|
|
|
|
t.integer "created_by_user_id", limit: 4
|
2015-09-23 22:38:20 +02:00
|
|
|
t.datetime "boxfill"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "invoice_id", limit: 4
|
2016-04-29 15:28:05 +02:00
|
|
|
t.date "pickup"
|
2017-10-11 15:53:58 +02:00
|
|
|
t.datetime "last_sent_mail"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "end_action", limit: 4, default: 0, null: false
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "orders", ["state"], name: "index_orders_on_state", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "page_versions", force: :cascade do |t|
|
|
|
|
t.integer "page_id", limit: 4
|
|
|
|
t.integer "lock_version", limit: 4
|
|
|
|
t.text "body", limit: 65535
|
|
|
|
t.integer "updated_by", limit: 4
|
|
|
|
t.integer "redirect", limit: 4
|
|
|
|
t.integer "parent_id", limit: 4
|
2009-08-12 18:41:25 +02:00
|
|
|
t.datetime "updated_at"
|
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "page_versions", ["page_id"], name: "index_page_versions_on_page_id", using: :btree
|
2009-08-12 18:41:25 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "pages", force: :cascade do |t|
|
|
|
|
t.string "title", limit: 255
|
|
|
|
t.text "body", limit: 65535
|
|
|
|
t.string "permalink", limit: 255
|
|
|
|
t.integer "lock_version", limit: 4, default: 0
|
|
|
|
t.integer "updated_by", limit: 4
|
|
|
|
t.integer "redirect", limit: 4
|
|
|
|
t.integer "parent_id", limit: 4
|
2009-08-12 18:41:25 +02:00
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "pages", ["permalink"], name: "index_pages_on_permalink", using: :btree
|
|
|
|
add_index "pages", ["title"], name: "index_pages_on_title", using: :btree
|
2009-08-15 17:36:13 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "periodic_task_groups", force: :cascade do |t|
|
2012-11-28 10:13:54 +01:00
|
|
|
t.date "next_task_date"
|
2014-02-20 15:04:53 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2012-11-28 10:13:54 +01:00
|
|
|
end
|
|
|
|
|
2017-11-05 22:16:32 +01:00
|
|
|
create_table "poll_choices", force: :cascade do |t|
|
|
|
|
t.integer "poll_vote_id", limit: 4, null: false
|
|
|
|
t.integer "choice", limit: 4, null: false
|
|
|
|
t.integer "value", limit: 4, null: false
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "poll_choices", ["poll_vote_id", "choice"], name: "index_poll_choices_on_poll_vote_id_and_choice", unique: true, using: :btree
|
|
|
|
|
|
|
|
create_table "poll_votes", force: :cascade do |t|
|
|
|
|
t.integer "poll_id", limit: 4, null: false
|
|
|
|
t.integer "user_id", limit: 4, null: false
|
|
|
|
t.integer "ordergroup_id", limit: 4
|
|
|
|
t.text "note", limit: 65535
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "poll_votes", ["poll_id", "user_id", "ordergroup_id"], name: "index_poll_votes_on_poll_id_and_user_id_and_ordergroup_id", unique: true, using: :btree
|
|
|
|
|
|
|
|
create_table "polls", force: :cascade do |t|
|
|
|
|
t.integer "created_by_user_id", limit: 4, null: false
|
|
|
|
t.string "name", limit: 255, null: false
|
|
|
|
t.text "description", limit: 65535
|
|
|
|
t.datetime "starts"
|
|
|
|
t.datetime "ends"
|
|
|
|
t.boolean "one_vote_per_ordergroup", default: false, null: false
|
|
|
|
t.text "required_ordergroup_custom_fields", limit: 65535
|
|
|
|
t.text "required_user_custom_fields", limit: 65535
|
|
|
|
t.integer "voting_method", limit: 4, null: false
|
|
|
|
t.string "choices", limit: 255, null: false
|
|
|
|
t.integer "final_choice", limit: 4
|
|
|
|
t.integer "multi_select_count", limit: 4, default: 0, null: false
|
|
|
|
t.integer "min_points", limit: 4
|
|
|
|
t.integer "max_points", limit: 4
|
|
|
|
t.datetime "created_at"
|
|
|
|
t.datetime "updated_at"
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "polls", ["final_choice"], name: "index_polls_on_final_choice", using: :btree
|
|
|
|
|
2019-02-02 12:40:57 +01:00
|
|
|
create_table "printer_job_updates", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "printer_job_id", limit: 4, null: false
|
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.string "state", limit: 255, null: false
|
|
|
|
t.text "message", limit: 65535
|
2019-02-02 12:40:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index "printer_job_updates", ["printer_job_id", "created_at"], name: "index_printer_job_updates_on_printer_job_id_and_created_at", using: :btree
|
|
|
|
|
|
|
|
create_table "printer_jobs", force: :cascade do |t|
|
2019-11-13 11:35:57 +01:00
|
|
|
t.integer "order_id", limit: 4
|
|
|
|
t.string "document", limit: 255, null: false
|
|
|
|
t.integer "created_by_user_id", limit: 4, null: false
|
|
|
|
t.integer "finished_by_user_id", limit: 4
|
2019-02-02 12:40:57 +01:00
|
|
|
t.datetime "finished_at"
|
|
|
|
end
|
|
|
|
|
|
|
|
add_index "printer_jobs", ["finished_at"], name: "index_printer_jobs_on_finished_at", using: :btree
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "settings", force: :cascade do |t|
|
|
|
|
t.string "var", limit: 255, null: false
|
|
|
|
t.text "value", limit: 65535
|
|
|
|
t.integer "thing_id", limit: 4
|
2014-02-20 15:04:53 +01:00
|
|
|
t.string "thing_type", limit: 30
|
2015-02-27 17:28:50 +01:00
|
|
|
t.datetime "created_at", null: false
|
|
|
|
t.datetime "updated_at", null: false
|
2013-06-06 03:40:15 +02:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "settings", ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
|
2013-06-06 03:40:15 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "stock_changes", force: :cascade do |t|
|
|
|
|
t.integer "delivery_id", limit: 4
|
|
|
|
t.integer "order_id", limit: 4
|
|
|
|
t.integer "stock_article_id", limit: 4
|
|
|
|
t.integer "quantity", limit: 4, default: 0
|
2009-01-16 02:17:49 +01:00
|
|
|
t.datetime "created_at"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.integer "stock_taking_id", limit: 4
|
2009-01-16 02:17:49 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "stock_changes", ["delivery_id"], name: "index_stock_changes_on_delivery_id", using: :btree
|
|
|
|
add_index "stock_changes", ["stock_article_id"], name: "index_stock_changes_on_stock_article_id", using: :btree
|
|
|
|
add_index "stock_changes", ["stock_taking_id"], name: "index_stock_changes_on_stock_taking_id", using: :btree
|
2009-09-07 15:35:19 +02:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "stock_takings", force: :cascade do |t|
|
2009-02-12 18:32:20 +01:00
|
|
|
t.date "date"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.text "note", limit: 65535
|
2009-02-12 18:32:20 +01:00
|
|
|
t.datetime "created_at"
|
|
|
|
end
|
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "suppliers", force: :cascade do |t|
|
|
|
|
t.string "name", limit: 255, default: "", null: false
|
|
|
|
t.string "address", limit: 255, default: "", null: false
|
|
|
|
t.string "phone", limit: 255, default: "", null: false
|
|
|
|
t.string "phone2", limit: 255
|
|
|
|
t.string "fax", limit: 255
|
|
|
|
t.string "email", limit: 255
|
|
|
|
t.string "url", limit: 255
|
|
|
|
t.string "contact_person", limit: 255
|
|
|
|
t.string "customer_number", limit: 255
|
|
|
|
t.string "delivery_days", limit: 255
|
|
|
|
t.string "order_howto", limit: 255
|
|
|
|
t.string "note", limit: 255
|
|
|
|
t.integer "shared_supplier_id", limit: 4
|
|
|
|
t.string "min_order_quantity", limit: 255
|
2009-01-20 19:37:15 +01:00
|
|
|
t.datetime "deleted_at"
|
2015-02-27 17:28:50 +01:00
|
|
|
t.string "shared_sync_method", limit: 255
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "iban", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "suppliers", ["name"], name: "index_suppliers_on_name", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "tasks", force: :cascade do |t|
|
2020-03-06 13:04:03 +01:00
|
|
|
t.string "name", limit: 255, default: "", null: false
|
|
|
|
t.text "description", limit: 65535
|
2009-01-06 11:49:19 +01:00
|
|
|
t.date "due_date"
|
2020-03-06 13:04:03 +01:00
|
|
|
t.boolean "done", default: false
|
2015-02-27 17:28:50 +01:00
|
|
|
t.integer "workgroup_id", limit: 4
|
2020-03-06 13:04:03 +01:00
|
|
|
t.datetime "created_on", null: false
|
|
|
|
t.datetime "updated_on", null: false
|
|
|
|
t.integer "required_users", limit: 4, default: 1
|
|
|
|
t.integer "duration", limit: 4, default: 1
|
2015-02-27 17:28:50 +01:00
|
|
|
t.integer "periodic_task_group_id", limit: 4
|
2020-03-06 13:04:03 +01:00
|
|
|
t.integer "created_by_user_id", limit: 4
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "tasks", ["due_date"], name: "index_tasks_on_due_date", using: :btree
|
|
|
|
add_index "tasks", ["name"], name: "index_tasks_on_name", using: :btree
|
|
|
|
add_index "tasks", ["workgroup_id"], name: "index_tasks_on_workgroup_id", using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
2015-02-27 17:28:50 +01:00
|
|
|
create_table "users", force: :cascade do |t|
|
|
|
|
t.string "nick", limit: 255
|
|
|
|
t.string "password_hash", limit: 255, default: "", null: false
|
|
|
|
t.string "password_salt", limit: 255, default: "", null: false
|
|
|
|
t.string "first_name", limit: 255, default: "", null: false
|
|
|
|
t.string "last_name", limit: 255, default: "", null: false
|
|
|
|
t.string "email", limit: 255, default: "", null: false
|
|
|
|
t.string "phone", limit: 255
|
|
|
|
t.datetime "created_on", null: false
|
|
|
|
t.string "reset_password_token", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
t.datetime "reset_password_expires"
|
|
|
|
t.datetime "last_login"
|
2015-03-03 14:55:30 +01:00
|
|
|
t.datetime "last_activity"
|
2016-03-04 19:03:52 +01:00
|
|
|
t.datetime "deleted_at"
|
2019-11-13 11:35:57 +01:00
|
|
|
t.string "iban", limit: 255
|
2009-01-06 11:49:19 +01:00
|
|
|
end
|
|
|
|
|
2014-02-20 15:04:53 +01:00
|
|
|
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
|
|
|
add_index "users", ["nick"], name: "index_users_on_nick", unique: true, using: :btree
|
2009-01-06 11:49:19 +01:00
|
|
|
|
|
|
|
end
|