Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [SYMFONY][DOCTRINE] General error: 1005 Can't create table 'jobeet.#sql-510_1d' ( errno: 150)
Forum PHP.pl > Forum > PHP > Frameworki
diasek7
witam, udalo mi sie zrobic jobeeta i teraz probuje cos z pluginami. mam problem z tym http://www.symfony-project.org/plugins/sfDoctrineApplyPlugin

schema.yml wyglada tak:

  1. JobeetCategory:
  2. actAs:
  3. Timestampable: ~
  4. I18n:
  5. fields: [name]
  6. actAs:
  7. Sluggable: { fields: [name], uniqueBy: [lang, name] }
  8. columns:
  9. name: { type: string(255), notnull: true }
  10.  
  11. JobeetJob:
  12. actAs: { Timestampable: ~ }
  13. columns:
  14. category_id: { type: integer, notnull: true }
  15. type: { type: string(255) }
  16. company: { type: string(255), notnull: true }
  17. logo: { type: string(255) }
  18. url: { type: string(255) }
  19. position: { type: string(255), notnull: true }
  20. location: { type: string(255), notnull: true }
  21. description: { type: string(4000), notnull: true }
  22. how_to_apply: { type: string(4000), notnull: true }
  23. token: { type: string(255), notnull: true, unique: true }
  24. is_public: { type: boolean, notnull: true, default: 1 }
  25. is_activated: { type: boolean, notnull: true, default: 0 }
  26. email: { type: string(255), notnull: true }
  27. expires_at: { type: timestamp, notnull: true }
  28. relations:
  29. JobeetCategory: { onDelete: CASCADE, local: category_id, foreign: id, foreignAlias: JobeetJobs }
  30.  
  31. JobeetAffiliate:
  32. actAs: { Timestampable: ~ }
  33. columns:
  34. url: { type: string(255), notnull: true }
  35. email: { type: string(255), notnull: true, unique: true }
  36. token: { type: string(255), notnull: true }
  37. is_active: { type: boolean, notnull: true, default: 0 }
  38. relations:
  39. JobeetCategories:
  40. class: JobeetCategory
  41. refClass: JobeetCategoryAffiliate
  42. local: affiliate_id
  43. foreign: category_id
  44. foreignAlias: JobeetAffiliates
  45.  
  46. JobeetCategoryAffiliate:
  47. columns:
  48. category_id: { type: integer, primary: true }
  49. affiliate_id: { type: integer, primary: true }
  50. relations:
  51. JobeetCategory: { onDelete: CASCADE, local: category_id, foreign: id }
  52. JobeetAffiliate: { onDelete: CASCADE, local: affiliate_id, foreign: id }
  53.  
  54. sfGuardUserProfile:
  55. tableName: sf_guard_user_profile
  56. columns:
  57. id:
  58. type: integer(4)
  59. primary: true
  60. autoincrement: true
  61. user_id:
  62. type: integer(4)
  63. notnull: true
  64. email:
  65. type: string(80)
  66. fullname:
  67. type: string(80)
  68. validate:
  69. type: string(17)
  70.  
  71. relations:
  72. User:
  73. class: sfGuardUser
  74. foreign: id
  75. local: user_id
  76. type: one
  77. onDelete: cascade
  78. foreignType: one
  79. foreignAlias: Profile


laduje mi sie to wszystko

php symfony doctrine:build --all --and-load --no-confirmation

i na koncu;

Kod
>> doctrine  generating sql for models
>> doctrine  Generated SQL successfully for models
>> doctrine  creating tables


  SQLSTATE[HY000]: General error: 1005 Can't create table 'jobeet.#sql-510_1d' (
errno: 150). Failing Query: "ALTER TABLE sf_guard_user_profile ADD CONSTRAINT sf
_guard_user_profile_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf
_guard_user(id) ON DELETE CASCADE". Failing Query: ALTER TABLE sf_guard_user_pro
file ADD CONSTRAINT sf_guard_user_profile_user_id_sf_guard_user_id FOREIGN KEY (
user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE


nie bardzo rozumiem o co tutaj chodzi...

pozdrawiam
destroyerr
Przeczytałeś i zrozumiałeś błąd jaki wyskoczył z bazy danych? Poszukałeś w google jak taki problem rozwiązać?

Podpowiem, że relacja ma różne typy kolumn, resztę powinieneś sam wykombinować na podstawię błędu, ew. google.
diasek7
dzieki, wystarczylo zmienic one na integer. a co wlasciwie robi to "one"? nie moge znalezc wytlumaczenia w google.
destroyerr
Jesteś pewien, że to wystarczyło i tabele są wygenerowane poprawnie?
To wskazuje jaki typ relacji ma być użyty. Szczegóły tu i tu
diasek7
nie jestem pewien, ale wyswietlilo, ze wygenerowano poprawnie. a co wedlug Ciebie jeszcze tam jest zle?

a to one oznacza w takim razie, ze jest tylko jeden klucz obcy?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.