Replies: 1 comment
-
|
I think I haven’t seen this kind of error before. An issue I’ve encountered previously were related to schema naming, where I had to adjust something in import Inflector, Genie
if ! isempty(Genie.config.inflector_irregulars)
push!(Inflector.IRREGULAR_NOUNS, Genie.config.inflector_irregulars...)
end
push!(Inflector.IRREGULAR_NOUNS, ("apikey", "apikeys"))How did you start your app? I’m asking because the issue might be environment-related. I usually start it by cd-ing into the app directory and then running |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for making Genie and SearchLight.
I just wanted to share my experience creating multiple tables in a PostGreSQL database using Genie.Generator.newresource("tablename") and then SearchLight.Generator.newresource("tablename") and then SearchLight.Migrate.up() or SearchLight.Migrate.last_up().
I have created the four tables shown below by following this sequence:
6.1 SearchLight.Migrate.last_up() # for each following table
For the first database table, there are no errors, it works perfectly. However, creating each of the following tables (books, formats, genres) generates huge amounts of errors -- but otherwise still works perfectly.
For example:
julia> Genie.Generator.newresource("genre")
ERROR: ArgumentError: Package Genie does not have SearchLight in its dependencies:
Pkg.instantiate()to ensure all packages in the environment are installed.
added SearchLight as a dependency but haven't updated your primary
environment's manifest file, try
Pkg.resolve().Stacktrace:
[1] macro expansion
@ ./loading.jl:2406 [inlined]
[2] macro expansion
@ ./lock.jl:376 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:2386
[4] require(into::Module, mod::Symbol)
@ Base ./loading.jl:2362
[5] top-level scope
@ ~/MyGenieApp/app/resources/authors/AuthorsValidator.jl:3
in expression starting at /Users/haimingwei/MyGenieApp/app/resources/authors/AuthorsValidator.jl:3
ERROR: ArgumentError: Package Genie does not have SearchLight in its dependencies:
Pkg.instantiate()to ensure all packages in the environment are installed.
added SearchLight as a dependency but haven't updated your primary
environment's manifest file, try
Pkg.resolve().Stacktrace:
[1] macro expansion
@ ./loading.jl:2406 [inlined]
[2] macro expansion
@ ./lock.jl:376 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:2386
[4] require(into::Module, mod::Symbol)
@ Base ./loading.jl:2362
[5] top-level scope
@ ~/MyGenieApp/app/resources/books/BooksValidator.jl:3
in expression starting at /Users/haimingwei/MyGenieApp/app/resources/books/BooksValidator.jl:3
ERROR: ArgumentError: Package Genie does not have SearchLight in its dependencies:
Pkg.instantiate()to ensure all packages in the environment are installed.
added SearchLight as a dependency but haven't updated your primary
environment's manifest file, try
Pkg.resolve().Stacktrace:
[1] macro expansion
@ ./loading.jl:2406 [inlined]
[2] macro expansion
@ ./lock.jl:376 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:2386
[4] require(into::Module, mod::Symbol)
@ Base ./loading.jl:2362
[5] top-level scope
@ ~/MyGenieApp/app/resources/authors/Authors.jl:3
in expression starting at /Users/haimingwei/MyGenieApp/app/resources/authors/Authors.jl:3
ERROR: ArgumentError: Package Genie does not have SearchLight in its dependencies:
Pkg.instantiate()to ensure all packages in the environment are installed.
added SearchLight as a dependency but haven't updated your primary
environment's manifest file, try
Pkg.resolve().Stacktrace:
[1] macro expansion
@ ./loading.jl:2406 [inlined]
[2] macro expansion
@ ./lock.jl:376 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:2386
[4] require(into::Module, mod::Symbol)
@ Base ./loading.jl:2362
[5] top-level scope
@ ~/MyGenieApp/app/resources/books/Books.jl:3
in expression starting at /Users/haimingwei/MyGenieApp/app/resources/books/Books.jl:3
[ Info: New GenresController.jl created at /Users/haimingwei/MyGenieApp/app/resources/genres/GenresController.jl
After that, I do
julia> using SearchLight
julia> SearchLight.Generator.newresource("genre")
[ Info: New model created at /Users/haimingwei/MyGenieApp/app/resources/genres/Genres.jl
[ Info: New table migration created at /Users/haimingwei/MyGenieApp/db/migrations/2026010919064346_create_table_genres.jl
[ Info: New validator created at /Users/haimingwei/MyGenieApp/app/resources/genres/GenresValidator.jl
[ Info: New unit test created at /Users/haimingwei/MyGenieApp/test/genres_test.jl
julia> edit("db/migrations/2026010919064346_create_table_genres.jl")
julia> SearchLight.Migration.init()
[ Info: CREATE TABLE schema_migrations (version varchar(30))
[error | LibPQ]: DuplicateTable: ERROR: relation "schema_migrations" already exists
ERROR: DuplicateTable: ERROR: relation "schema_migrations" already exists
Stacktrace:
[1] error(logger::Memento.Logger, exc::LibPQ.Errors.PQResultError{LibPQ.Errors.C42, LibPQ.Errors.E42P07})
@ Memento ~/.julia/packages/Memento/xnHxE/src/loggers.jl:463
[2] handle_result(jl_result::LibPQ.Result{false}; throw_error::Bool)
@ LibPQ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:238
[3] handle_result
@ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:230 [inlined]
[4] #_multi_execute#60
@ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:305 [inlined]
[5] _multi_execute
@ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:298 [inlined]
[6] #execute#59
@ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:294 [inlined]
[7] execute
@ ~/.julia/packages/LibPQ/i4yBe/src/results.jl:290 [inlined]
[8] query(sql::String, conn::LibPQ.Connection)
@ SearchLightPostgreSQL ~/.julia/packages/SearchLightPostgreSQL/sm4X4/src/SearchLightPostgreSQL.jl:137
[9] query
@ ~/.julia/packages/SearchLightPostgreSQL/sm4X4/src/SearchLightPostgreSQL.jl:136 [inlined]
[10] create_migrations_table(table_name::String)
@ SearchLightPostgreSQL ~/.julia/packages/SearchLightPostgreSQL/sm4X4/src/SearchLightPostgreSQL.jl:305
[11] top-level scope
@ REPL[32]:1
julia> SearchLight.Migration.lastup()
[ Info: SELECT version FROM schema_migrations ORDER BY version DESC
[ Info: CREATE TABLE genres (id SERIAL PRIMARY KEY , genre_id INTEGER , genre_name VARCHAR (108))
[ Info: CREATE INDEX genres__idx_genre_id ON genres (genre_id)
[ Info: CREATE INDEX genres__idx_genre_name ON genres (genre_name)
[ Info: INSERT INTO schema_migrations VALUES ('2026010919064346')
[ Info: Executed migration CreateTableGenres up
= = = =
I did check the database after each attempt to create the table using the above sequence, and each time it worked perfect based upon the database output.
akhara=# \dt
List of relations
Schema | Name | Type | Owner
--------+-------------------+-------+------------
akhara | authors | table | haimingwei
akhara | books | table | haimingwei
akhara | formats | table | haimingwei
akhara | genres | table | haimingwei
akhara | schema_migrations | table | haimingwei
(5 rows)
akhara=# select * from akhara.schema_migrations;
version
2026010918142107
2026010918355315
2026010919064346
2026010919142930
(4 rows)
So it seems like there may be a problem with the Genie.Generator.newresource() and/or the SearchLight.Generator.newresource() and/or the SearchLight.Migrate.init()
Also: I have used the pkg> activate . and pkg> status
(MyGenieApp) pkg> status
Project MyGenieApp v0.1.0
Status
~/MyGenieApp/Project.toml[c43c736e] Genie v5.35.5
[6d011eab] Inflector v1.1.0
[340e8cb6] SearchLight v2.11.2
[4327cdd6] SearchLightPostgreSQL v2.4.0
[ade2ca70] Dates v1.11.0
[56ddb016] Logging v1.11.0
So the ArgumentError: Package Genie does not have SearchLight in its dependencies -- makes no sense to me.
Thanks for your kind feedback.
Beta Was this translation helpful? Give feedback.
All reactions