# 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 => 20090407123606) do

  create_table "demo", :force => true do |t|
    t.integer "ido",                          :null => false
    t.integer "state",                        :null => false
    t.integer "date_from",                    :null => false
    t.integer "time_from",                    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                  :null => false
    t.integer "time_create",                  :null => false
    t.integer "owner_id",                     :null => false
    t.integer "creator_id",                   :null => false
    t.integer "operation_id",                 :null => false
    t.string  "explanation",  :limit => 1024
  end

  add_index "demo", ["date_from", "explanation", "state", "time_from"], :name => "demo_i3", :unique => true
  add_index "demo", ["date_from", "ido", "state", "time_from"], :name => "demo_i2", :unique => true

  create_table "elist1001", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.float   "pruefpoly"
    t.float   "pruefmitte"
    t.float   "pruefhoehe"
    t.float   "pruefabgg"
    t.string  "lbehurl",      :limit => 500
    t.string  "lbehname",     :limit => 250
    t.string  "lbehplz",      :limit => 20
    t.string  "lbehort",      :limit => 60
    t.string  "lbehstr",      :limit => 60
    t.string  "lbehnr",       :limit => 12
    t.string  "lbehtel",      :limit => 30
    t.string  "lbehfax",      :limit => 30
    t.string  "lbehemail",    :limit => 100
    t.string  "f1",           :limit => 500
    t.string  "f2",           :limit => 100
    t.string  "f3",           :limit => 100
    t.float   "n1"
    t.float   "n2"
    t.float   "n3"
    t.string  "bland",        :limit => 2,   :null => false
  end

  add_index "elist1001", ["date_from", "ido", "state", "time_from"], :name => "elist1001_i2", :unique => true
  add_index "elist1001", ["date_from", "schl", "state", "time_from"], :name => "elist1001_i3", :unique => true

  create_table "elist1002", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 5,   :null => false
    t.string  "sortier",      :limit => 5,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.string  "behplz",       :limit => 20
    t.string  "behort",       :limit => 60
    t.string  "behstr",       :limit => 60
    t.string  "behnr",        :limit => 12
    t.string  "behtel",       :limit => 30
    t.string  "behfax",       :limit => 30
    t.string  "behemail",     :limit => 100
    t.integer "bland_id",                    :null => false
  end

  add_index "elist1002", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist1002_i3", :unique => true
  add_index "elist1002", ["date_from", "ido", "state", "time_from"], :name => "elist1002_i2", :unique => true

  create_table "elist1003", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 8,   :null => false
    t.string  "sortier",      :limit => 8,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.float   "rechtsol"
    t.float   "hochol"
    t.float   "rechtsur"
    t.float   "hochur"
    t.float   "rechtsol1"
    t.float   "hochol1"
    t.float   "rechtsur1"
    t.float   "hochur1"
    t.float   "rechtsm"
    t.float   "hochm"
    t.float   "rechtsm1"
    t.float   "hochm1"
    t.string  "plz",          :limit => 7
    t.integer "bland_id",                    :null => false
  end

  add_index "elist1003", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist1003_i3", :unique => true
  add_index "elist1003", ["date_from", "ido", "state", "time_from"], :name => "elist1003_i2", :unique => true

  create_table "elist1007", :force => true do |t|
    t.integer "ido",                             :null => false
    t.integer "state",                           :null => false
    t.integer "date_from",                       :null => false
    t.integer "time_from",                       :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                     :null => false
    t.integer "time_create",                     :null => false
    t.integer "owner_id",                        :null => false
    t.integer "creator_id",                      :null => false
    t.integer "operation_id",                    :null => false
    t.string  "schl",             :limit => 3,   :null => false
    t.string  "sortier",          :limit => 3,   :null => false
    t.string  "ktext",            :limit => 100
    t.string  "ltext",            :limit => 240
    t.integer "gewaesserschl_id"
    t.integer "bland_id",                        :null => false
  end

  add_index "elist1007", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist1007_i3", :unique => true
  add_index "elist1007", ["date_from", "ido", "state", "time_from"], :name => "elist1007_i2", :unique => true

  create_table "elist2003", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 3,   :null => false
    t.string  "sortier",      :limit => 3,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.string  "aggrnr",       :limit => 2
    t.integer "sgruppe_id"
    t.integer "bland_id",                    :null => false
  end

  add_index "elist2003", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist2003_i3", :unique => true
  add_index "elist2003", ["date_from", "ido", "state", "time_from"], :name => "elist2003_i2", :unique => true

  create_table "elist2006", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 20,  :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 150
    t.string  "ltext",        :limit => 240
    t.integer "methode_id"
    t.integer "bland_id",                    :null => false
  end

  add_index "elist2006", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist2006_i3", :unique => true
  add_index "elist2006", ["date_from", "ido", "state", "time_from"], :name => "elist2006_i2", :unique => true

  create_table "elist2011", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 20,  :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "methode_id"
    t.integer "bland_id",                    :null => false
  end

  add_index "elist2011", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist2011_i3", :unique => true
  add_index "elist2011", ["date_from", "ido", "state", "time_from"], :name => "elist2011_i2", :unique => true

  create_table "elist2012", :force => true do |t|
    t.integer "ido",                           :null => false
    t.integer "state",                         :null => false
    t.integer "date_from",                     :null => false
    t.integer "time_from",                     :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                   :null => false
    t.integer "time_create",                   :null => false
    t.integer "owner_id",                      :null => false
    t.integer "creator_id",                    :null => false
    t.integer "operation_id",                  :null => false
    t.string  "schl",           :limit => 2,   :null => false
    t.string  "sortier",        :limit => 2,   :null => false
    t.string  "ktext",          :limit => 150
    t.string  "ltext",          :limit => 240
    t.string  "auswahl",        :limit => 1
    t.integer "gvorschrift_id"
    t.integer "bland_id",                      :null => false
  end

  add_index "elist2012", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "elist2012_i3", :unique => true
  add_index "elist2012", ["date_from", "ido", "state", "time_from"], :name => "elist2012_i2", :unique => true

  create_table "fields", :force => true do |t|
    t.integer "table_id",                         :null => false
    t.string  "type",               :limit => 3,  :null => false
    t.string  "name",               :limit => 32, :null => false
    t.integer "pointer2table_id"
    t.string  "pointers2field_ids"
    t.integer "notnullfield",                     :null => false
    t.integer "primaryfield",                     :null => false
    t.string  "label",                            :null => false
    t.string  "description"
    t.string  "format"
    t.integer "tablecolumn",                      :null => false
  end

  add_index "fields", ["label"], :name => "fields_i8"
  add_index "fields", ["name", "table_id"], :name => "fields_i2", :unique => true
  add_index "fields", ["name"], :name => "fields_i5"
  add_index "fields", ["notnullfield"], :name => "fields_i6"
  add_index "fields", ["primaryfield"], :name => "fields_i7"
  add_index "fields", ["table_id"], :name => "fields_i3"
  add_index "fields", ["tablecolumn"], :name => "fields_i9"
  add_index "fields", ["type"], :name => "fields_i4"

  create_table "operations", :force => true do |t|
    t.string "item"
  end

  add_index "operations", ["item"], :name => "operations_i2", :unique => true

  create_table "p_betrieb", :force => true do |t|
    t.integer "ido",                           :null => false
    t.integer "state",                         :null => false
    t.integer "date_from",                     :null => false
    t.integer "time_from",                     :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                   :null => false
    t.integer "time_create",                   :null => false
    t.integer "owner_id",                      :null => false
    t.integer "creator_id",                    :null => false
    t.integer "operation_id",                  :null => false
    t.integer "s_arb_id"
    t.string  "refkatbt",      :limit => 40
    t.string  "refkatbs",      :limit => 40
    t.string  "kennnr",        :limit => 30
    t.integer "land_id"
    t.integer "behnr_id"
    t.string  "astnr",         :limit => 20
    t.string  "einleitnr",     :limit => 210
    t.string  "erzeuger",      :limit => 110
    t.string  "bname1",        :limit => 120
    t.string  "bname2",        :limit => 80
    t.string  "name1",         :limit => 120
    t.string  "name2",         :limit => 80
    t.string  "betname",       :limit => 200
    t.string  "eigname",       :limit => 200
    t.string  "strasse",       :limit => 60
    t.string  "nr",            :limit => 12
    t.string  "plzstr",        :limit => 7
    t.string  "ort",           :limit => 60
    t.integer "gemde_id"
    t.integer "rechtsw"
    t.integer "hochw"
    t.integer "grefsys_id"
    t.integer "flezgeb_id"
    t.integer "nace_id"
    t.string  "prodvol",       :limit => 60
    t.integer "anlzahl"
    t.integer "betriebh"
    t.integer "beszahl"
    t.string  "email",         :limit => 60
    t.string  "bemerk",        :limit => 1000
    t.string  "geheimd",       :limit => 1000
    t.integer "freisl_id"
    t.integer "freisb_id"
    t.integer "freisw_id"
    t.integer "verbw_id"
    t.integer "verba_id"
    t.integer "verbang_id"
    t.integer "freigabe_date"
    t.integer "freigabe_time"
    t.integer "abgabeer_date"
    t.integer "abgabeer_time"
    t.integer "abgabele_date"
    t.integer "abgabele_time"
    t.integer "bearb_id"
    t.integer "pruefg_id"
    t.string  "bgeheimb",      :limit => 1000
    t.string  "bbemerk",       :limit => 1000
    t.integer "pruefl_id"
    t.integer "pruefb_id"
    t.integer "pruefw_id"
    t.integer "pruefa_id"
    t.integer "pruefdb_date"
    t.integer "pruefdb_time"
    t.integer "laenddat_date"
    t.integer "laenddat_time"
    t.string  "jahr",          :limit => 4
    t.integer "aenddat_date"
    t.integer "aenddat_time"
    t.string  "akz",           :limit => 12
    t.integer "geheimpd"
    t.integer "geheimge"
    t.integer "geheimbg"
    t.integer "bgeheim"
  end

  add_index "p_betrieb", ["date_from", "ido", "state", "time_from"], :name => "p_betrieb_i2", :unique => true
  add_index "p_betrieb", ["date_from", "kennnr", "land_id", "state", "time_from"], :name => "p_betrieb_i3", :unique => true

  create_table "p_betrieb_geheimk", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
    t.integer "p_betrieb_id", :null => false
    t.integer "geheimk_id",   :null => false
  end

  add_index "p_betrieb_geheimk", ["date_from", "geheimk_id", "p_betrieb_id", "state", "time_from"], :name => "p_betrieb_geheimk_i3", :unique => true
  add_index "p_betrieb_geheimk", ["date_from", "ido", "state", "time_from"], :name => "p_betrieb_geheimk_i2", :unique => true

  create_table "p_betrieb_vorgaenger", :force => true do |t|
    t.integer "ido",                     :null => false
    t.integer "state",                   :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",             :null => false
    t.integer "time_create",             :null => false
    t.integer "owner_id",                :null => false
    t.integer "creator_id",              :null => false
    t.integer "operation_id",            :null => false
    t.integer "p_betrieb_id",            :null => false
    t.integer "p_betrieb_vorgaenger_id", :null => false
  end

  add_index "p_betrieb_vorgaenger", ["date_from", "ido", "state", "time_from"], :name => "p_betrieb_vorgaenger_i2", :unique => true
  add_index "p_betrieb_vorgaenger", ["date_from", "p_betrieb_id", "p_betrieb_vorgaenger_id", "state", "time_from"], :name => "p_betrieb_vorgaenger_i3", :unique => true

  create_table "p_freis", :force => true do |t|
    t.integer "ido",                          :null => false
    t.integer "state",                        :null => false
    t.integer "date_from",                    :null => false
    t.integer "time_from",                    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                  :null => false
    t.integer "time_create",                  :null => false
    t.integer "owner_id",                     :null => false
    t.integer "creator_id",                   :null => false
    t.integer "operation_id",                 :null => false
    t.integer "p_betrieb_id"
    t.string  "refkat",       :limit => 40
    t.integer "medium_id"
    t.integer "stoffnr_id"
    t.float   "jfracht"
    t.float   "vfracht"
    t.float   "bamenge"
    t.integer "bestim_id"
    t.integer "bvcode_id"
    t.string  "bvmet",        :limit => 1000
    t.string  "geheimd",      :limit => 1000
    t.string  "bgeheimb",     :limit => 1000
    t.string  "jahr",         :limit => 4
    t.integer "aenddat_date"
    t.integer "aenddat_time"
    t.integer "geheim"
  end

  add_index "p_freis", ["date_from", "ido", "state", "time_from"], :name => "p_freis_i2", :unique => true
  add_index "p_freis", ["date_from", "jahr", "medium_id", "p_betrieb_id", "state", "stoffnr_id", "time_from"], :name => "p_freis_i3", :unique => true

  create_table "p_freis_geheimk", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
    t.integer "p_freis_id",   :null => false
    t.integer "geheimk_id",   :null => false
  end

  add_index "p_freis_geheimk", ["date_from", "geheimk_id", "p_freis_id", "state", "time_from"], :name => "p_freis_geheimk_i3", :unique => true
  add_index "p_freis_geheimk", ["date_from", "ido", "state", "time_from"], :name => "p_freis_geheimk_i2", :unique => true

  create_table "p_taet", :force => true do |t|
    t.integer "ido",                          :null => false
    t.integer "state",                        :null => false
    t.integer "date_from",                    :null => false
    t.integer "time_from",                    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                  :null => false
    t.integer "time_create",                  :null => false
    t.integer "owner_id",                     :null => false
    t.integer "creator_id",                   :null => false
    t.integer "operation_id",                 :null => false
    t.integer "p_betrieb_id"
    t.string  "refkat",       :limit => 40
    t.integer "nrprtr_id"
    t.integer "htprtr"
    t.integer "nrivu_id"
    t.string  "bgeheimb",     :limit => 1000
    t.string  "jahr",         :limit => 4
    t.integer "aenddat_date"
    t.integer "aenddat_time"
    t.string  "geheimd",      :limit => 1000
    t.integer "geheim"
  end

  add_index "p_taet", ["date_from", "ido", "state", "time_from"], :name => "p_taet_i2", :unique => true
  add_index "p_taet", ["date_from", "nrprtr_id", "p_betrieb_id", "state", "time_from"], :name => "p_taet_i3", :unique => true

  create_table "p_taet_geheimk", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
    t.integer "p_taet_id",    :null => false
    t.integer "geheimk_id",   :null => false
  end

  add_index "p_taet_geheimk", ["date_from", "geheimk_id", "p_taet_id", "state", "time_from"], :name => "p_taet_geheimk_i3", :unique => true
  add_index "p_taet_geheimk", ["date_from", "ido", "state", "time_from"], :name => "p_taet_geheimk_i2", :unique => true

  create_table "p_vabf", :force => true do |t|
    t.integer "ido",                          :null => false
    t.integer "state",                        :null => false
    t.integer "date_from",                    :null => false
    t.integer "time_from",                    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                  :null => false
    t.integer "time_create",                  :null => false
    t.integer "owner_id",                     :null => false
    t.integer "creator_id",                   :null => false
    t.integer "operation_id",                 :null => false
    t.integer "p_betrieb_id"
    t.string  "refkat",       :limit => 40
    t.integer "abfart_id"
    t.integer "aland_id"
    t.integer "astaat_id"
    t.integer "verbes_id"
    t.float   "menge"
    t.integer "bestim_id"
    t.integer "bvcode_id"
    t.string  "bvmet",        :limit => 1000
    t.string  "vbname",       :limit => 120
    t.string  "vbort",        :limit => 60
    t.string  "vbplz",        :limit => 20
    t.string  "vbstr",        :limit => 60
    t.string  "vbstrnr",      :limit => 12
    t.string  "vbsort",       :limit => 60
    t.string  "vbsplz",       :limit => 20
    t.string  "vbsstr",       :limit => 60
    t.string  "vbsstrnr",     :limit => 12
    t.string  "geheimd",      :limit => 1000
    t.string  "bgeheimp",     :limit => 1
    t.string  "bgeheimb",     :limit => 1000
    t.string  "jahr",         :limit => 4
    t.integer "aenddat_date"
    t.integer "aenddat_time"
    t.integer "geheim"
  end

  add_index "p_vabf", ["abfart_id", "aland_id", "astaat_id", "date_from", "jahr", "p_betrieb_id", "state", "time_from", "verbes_id"], :name => "p_vabf_i3", :unique => true
  add_index "p_vabf", ["date_from", "ido", "state", "time_from"], :name => "p_vabf_i2", :unique => true

  create_table "p_vabf_geheimk", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
    t.integer "p_vabf_id",    :null => false
    t.integer "geheimk_id",   :null => false
  end

  add_index "p_vabf_geheimk", ["date_from", "geheimk_id", "p_vabf_id", "state", "time_from"], :name => "p_vabf_geheimk_i3", :unique => true
  add_index "p_vabf_geheimk", ["date_from", "ido", "state", "time_from"], :name => "p_vabf_geheimk_i2", :unique => true

  create_table "p_vabw", :force => true do |t|
    t.integer "ido",                          :null => false
    t.integer "state",                        :null => false
    t.integer "date_from",                    :null => false
    t.integer "time_from",                    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                  :null => false
    t.integer "time_create",                  :null => false
    t.integer "owner_id",                     :null => false
    t.integer "creator_id",                   :null => false
    t.integer "operation_id",                 :null => false
    t.integer "p_betrieb_id"
    t.string  "refkat",       :limit => 40
    t.integer "stoffnr_id"
    t.float   "jfracht"
    t.float   "bamenge"
    t.integer "bestim_id"
    t.integer "bvcode_id"
    t.string  "bvmet",        :limit => 1000
    t.string  "geheimd",      :limit => 1000
    t.string  "bgeheimb",     :limit => 1000
    t.string  "jahr",         :limit => 4
    t.integer "aenddat_date"
    t.integer "aenddat_time"
    t.integer "geheim"
  end

  add_index "p_vabw", ["date_from", "ido", "state", "time_from"], :name => "p_vabw_i2", :unique => true
  add_index "p_vabw", ["date_from", "jahr", "p_betrieb_id", "state", "stoffnr_id", "time_from"], :name => "p_vabw_i3", :unique => true

  create_table "p_vabw_geheimk", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
    t.integer "p_vabw_id",    :null => false
    t.integer "geheimk_id",   :null => false
  end

  add_index "p_vabw_geheimk", ["date_from", "geheimk_id", "p_vabw_id", "state", "time_from"], :name => "p_vabw_geheimk_i3", :unique => true
  add_index "p_vabw_geheimk", ["date_from", "ido", "state", "time_from"], :name => "p_vabw_geheimk_i2", :unique => true

  create_table "permissions", :force => true do |t|
    t.string "permission"
  end

  add_index "permissions", ["permission"], :name => "permissions_i2", :unique => true

  create_table "releases", :id => false, :force => true do |t|
    t.string  "release",      :limit => 32,   :null => false
    t.integer "release_date"
    t.integer "release_time"
    t.string  "bemerkung",    :limit => 2048
  end

  create_table "slist0002", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist0002", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist0002_i3", :unique => true
  add_index "slist0002", ["date_from", "ido", "state", "time_from"], :name => "slist0002_i2", :unique => true

  create_table "slist1004", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 4,   :null => false
    t.string  "sortier",      :limit => 4,   :null => false
    t.string  "ktext",        :limit => 150
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1004", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1004_i3", :unique => true
  add_index "slist1004", ["date_from", "ido", "state", "time_from"], :name => "slist1004_i2", :unique => true

  create_table "slist1005", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1005", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1005_i3", :unique => true
  add_index "slist1005", ["date_from", "ido", "state", "time_from"], :name => "slist1005_i2", :unique => true

  create_table "slist1006", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 300
    t.string  "ltext",        :limit => 300
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1006", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1006_i3", :unique => true
  add_index "slist1006", ["date_from", "ido", "state", "time_from"], :name => "slist1006_i2", :unique => true

  create_table "slist1008", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 19,  :null => false
    t.string  "sortier",      :limit => 19,  :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1008", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1008_i3", :unique => true
  add_index "slist1008", ["date_from", "ido", "state", "time_from"], :name => "slist1008_i2", :unique => true

  create_table "slist1009", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from"
    t.integer "time_from"
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1009", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1009_i3", :unique => true
  add_index "slist1009", ["date_from", "ido", "state", "time_from"], :name => "slist1009_i2", :unique => true

  create_table "slist1010", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1010", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1010_i3", :unique => true
  add_index "slist1010", ["date_from", "ido", "state", "time_from"], :name => "slist1010_i2", :unique => true

  create_table "slist1102", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 10,  :null => false
    t.string  "sortier",      :limit => 3,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 500
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1102", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1102_i3", :unique => true
  add_index "slist1102", ["date_from", "ido", "state", "time_from"], :name => "slist1102_i2", :unique => true

  create_table "slist1103", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 10,  :null => false
    t.string  "sortier",      :limit => 3,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 500
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1103", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1103_i3", :unique => true
  add_index "slist1103", ["date_from", "ido", "state", "time_from"], :name => "slist1103_i2", :unique => true

  create_table "slist1201", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist1201", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist1201_i3", :unique => true
  add_index "slist1201", ["date_from", "ido", "state", "time_from"], :name => "slist1201_i2", :unique => true

  create_table "slist2001", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2001", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2001_i3", :unique => true
  add_index "slist2001", ["date_from", "ido", "state", "time_from"], :name => "slist2001_i2", :unique => true

  create_table "slist2002", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2002", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2002_i3", :unique => true
  add_index "slist2002", ["date_from", "ido", "state", "time_from"], :name => "slist2002_i2", :unique => true

  create_table "slist2004", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2004", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2004_i3", :unique => true
  add_index "slist2004", ["date_from", "ido", "state", "time_from"], :name => "slist2004_i2", :unique => true

  create_table "slist2007", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2007", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2007_i3", :unique => true
  add_index "slist2007", ["date_from", "ido", "state", "time_from"], :name => "slist2007_i2", :unique => true

  create_table "slist2008", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2008", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2008_i3", :unique => true
  add_index "slist2008", ["date_from", "ido", "state", "time_from"], :name => "slist2008_i2", :unique => true

  create_table "slist2009", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2009", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2009_i3", :unique => true
  add_index "slist2009", ["date_from", "ido", "state", "time_from"], :name => "slist2009_i2", :unique => true

  create_table "slist2010", :force => true do |t|
    t.integer "ido",                         :null => false
    t.integer "state",                       :null => false
    t.integer "date_from",                   :null => false
    t.integer "time_from",                   :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",                 :null => false
    t.integer "time_create",                 :null => false
    t.integer "owner_id",                    :null => false
    t.integer "creator_id",                  :null => false
    t.integer "operation_id",                :null => false
    t.string  "schl",         :limit => 2,   :null => false
    t.string  "sortier",      :limit => 2,   :null => false
    t.string  "ktext",        :limit => 100
    t.string  "ltext",        :limit => 240
    t.integer "bland_id",                    :null => false
  end

  add_index "slist2010", ["bland_id", "date_from", "schl", "state", "time_from"], :name => "slist2010_i3", :unique => true
  add_index "slist2010", ["date_from", "ido", "state", "time_from"], :name => "slist2010_i2", :unique => true

  create_table "tables", :force => true do |t|
    t.string  "class",                        :null => false
    t.string  "type",           :limit => 16, :null => false
    t.string  "name",           :limit => 32, :null => false
    t.string  "label",                        :null => false
    t.string  "description"
    t.integer "timewindowtype",               :null => false
  end

  add_index "tables", ["class"], :name => "tables_i2", :unique => true
  add_index "tables", ["label"], :name => "tables_i5"
  add_index "tables", ["name"], :name => "tables_i3", :unique => true
  add_index "tables", ["type"], :name => "tables_i4"

  create_table "team_permissions", :force => true do |t|
    t.integer "team_id",       :null => false
    t.integer "permission_id", :null => false
  end

  add_index "team_permissions", ["permission_id", "team_id"], :name => "team_permissions_i2", :unique => true

  create_table "teams", :force => true do |t|
    t.string "name"
  end

  add_index "teams", ["name"], :name => "teams_i2", :unique => true

  create_table "templates", :force => true do |t|
    t.integer "ido",          :null => false
    t.integer "state",        :null => false
    t.integer "date_from",    :null => false
    t.integer "time_from",    :null => false
    t.integer "date_to"
    t.integer "time_to"
    t.integer "date_create",  :null => false
    t.integer "time_create",  :null => false
    t.integer "owner_id",     :null => false
    t.integer "creator_id",   :null => false
    t.integer "operation_id", :null => false
  end

  create_table "users", :force => true do |t|
    t.string  "loginname"
    t.string  "password"
    t.integer "team_id",   :null => false
    t.integer "disabled",  :null => false
  end

  add_index "users", ["loginname"], :name => "users_i2", :unique => true

end
