Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. class CreateCompanies < ActiveRecord::Migration[5.1]
  2. def change
  3. create_table :companies do |t|
  4. t.string :ragione_sociale
  5. t.references :forma_giuridica, foreign_key: true
  6. t.string :telefono_fisso
  7. t.string :fax
  8. t.string :pec
  9. t.string :mail
  10. t.string :web_site
  11. t.string :cellulare_emergenze
  12. t.string :via_legale
  13. t.string :n_civico_legale
  14. t.string :citta_legale
  15. t.string :cap_legale
  16. t.string :provincia_legale
  17. t.string :regione_legale
  18. t.string :via_operativa
  19. t.string :n_civico_operativa
  20. t.string :citta_operativa
  21. t.string :cap_operativa
  22. t.string :provincia_operativa
  23. t.string :regione_operativa
  24. t.string :pi
  25. t.string :cf
  26. t.string :ateco_primo
  27. t.string :ateco_secondo
  28. t.string :ateco_altro
  29. t.timestamps
  30. end
  31. end
  32. end
  33.  
  34. # MySQL. Versions 5.1.10 and up are supported.
  35. #
  36. # Install the MySQL driver
  37. # gem install mysql2
  38. #
  39. # Ensure the MySQL gem is defined in your Gemfile
  40. # gem 'mysql2'
  41. #
  42. # And be sure to use new-style password hashing:
  43. # http://dev.mysql.com/doc/refman/5.7/en/old-client.html
  44. #
  45. default: &default
  46. adapter: mysql2
  47. encoding: utf8
  48. pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  49. username: root
  50. password: Pipipopo09
  51. host: localhost
  52. port: 3300
  53.  
  54. development:
  55. <<: *default
  56. database: Pluto_Demetra_development
  57.  
  58. # Warning: The database defined as "test" will be erased and
  59. # re-generated from your development database when you run "rake".
  60. # Do not set this db to the same as development or production.
  61. test:
  62. <<: *default
  63. database: Pluto_Demetra_test
  64.  
  65. # As with config/secrets.yml, you never want to store sensitive information,
  66. # like your database password, in your source code. If your source code is
  67. # ever seen by anyone, they now have access to your database.
  68. #
  69. # Instead, provide the password as a unix environment variable when you boot
  70. # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
  71. # for a full rundown on how to provide these environment variables in a
  72. # production deployment.
  73. #
  74. # On Heroku and other platform providers, you may have a full connection URL
  75. # available as an environment variable. For example:
  76. #
  77. # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
  78. #
  79. # You can use this database configuration with:
  80. #
  81. # production:
  82. # url: <%= ENV['DATABASE_URL'] %>
  83. #
  84. production:
  85. <<: *default
  86. database: Pluto_Demetra_production
  87. username: Pluto_Demetra
  88. password: <%= ENV['PLUTO_DEMETRA_DATABASE_PASSWORD'] %>
  89.  
  90. == 20170621125622 CreateCompanies: migrating ==================================
  91. -- create_table(:companies)
  92. rails aborted!
  93. StandardError: An error has occurred, all later migrations canceled:
  94.  
  95. Mysql2::Error: Table 'pluto_demetra_development.companies' doesn't exist: SHOW FULL FIELDS FROM `companies`
  96. C:/Users/gvieri.BSNSTRATEGIES/SitiRuby/Pluto_Demetra/db/migrate/20170621125622_create_companies.rb:3:in `change'
  97. bin/rails:4:in `require'
  98. bin/rails:4:in `<main>'
  99. ActiveRecord::StatementInvalid: Mysql2::Error: Table 'pluto_demetra_development.companies' doesn't exist: SHOW FULL FIELDS FROM `companies`
  100. C:/Users/gvieri.BSNSTRATEGIES/SitiRuby/Pluto_Demetra/db/migrate/20170621125622_create_companies.rb:3:in `change'
  101. bin/rails:4:in `require'
  102. bin/rails:4:in `<main>'
  103. Mysql2::Error: Table 'pluto_demetra_development.companies' doesn't exist
  104. C:/Users/gvieri.BSNSTRATEGIES/SitiRuby/Pluto_Demetra/db/migrate/20170621125622_create_companies.rb:3:in `change'
  105. bin/rails:4:in `require'
  106. bin/rails:4:in `<main>'
  107. Mysql2::Error: Cannot add foreign key constraint
  108. C:/Users/gvieri.BSNSTRATEGIES/SitiRuby/Pluto_Demetra/db/migrate/20170621125622_create_companies.rb:3:in `change'
  109. bin/rails:4:in `require'
  110. bin/rails:4:in `<main>'
  111. Tasks: TOP => db:migrate
  112. (See full trace by running task with --trace)
  113.  
  114. class CreateCompanies < ActiveRecord::Migration[5.0]
  115. end
  116.  
  117. class CreateCompanies < ActiveRecord::Migration[5.1]
  118. def change
  119. create_table :companies do |t|
  120. t.string :ragione_sociale
  121. t.references :forma_giuridica # , foreign_key: true
  122. # ...
  123. end
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement