Learn more about these different git repos.
Other Git URLs
Neither the createdb script nor alembic are able to create the database for Pagure with MySQL:
createdb:
$ grep DB /etc/pagure/pagure.cfg DB_URL='mysql://pagure:blah@localhost/pagure' $ PAGURE_CONFIG=/etc/pagure/pagure.cfg python /usr/share/pagure/pagure_createdb.py <snip various tables created> 2017-06-28 09:35:25,266 INFO sqlalchemy.engine.base.Engine () 2017-06-28 09:35:25,266 [INFO] sqlalchemy.engine.base.Engine: () 2017-06-28 09:35:25,268 INFO sqlalchemy.engine.base.Engine ROLLBACK 2017-06-28 09:35:25,268 [INFO] sqlalchemy.engine.base.Engine: ROLLBACK 2017-06-28 09:35:25,273 INFO sqlalchemy.engine.base.Engine CREATE TABLE issue_keys ( id INTEGER NOT NULL AUTO_INCREMENT, project_id INTEGER NOT NULL, name TEXT NOT NULL, key_type VARCHAR(255) NOT NULL, key_data TEXT, key_notify BOOL NOT NULL, CONSTRAINT issue_keys_pkey PRIMARY KEY (id), CONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), CONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, CHECK (key_notify IN (0, 1)) ) 2017-06-28 09:35:25,273 [INFO] sqlalchemy.engine.base.Engine: CREATE TABLE issue_keys ( id INTEGER NOT NULL AUTO_INCREMENT, project_id INTEGER NOT NULL, name TEXT NOT NULL, key_type VARCHAR(255) NOT NULL, key_data TEXT, key_notify BOOL NOT NULL, CONSTRAINT issue_keys_pkey PRIMARY KEY (id), CONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), CONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, CHECK (key_notify IN (0, 1)) ) 2017-06-28 09:35:25,273 INFO sqlalchemy.engine.base.Engine () 2017-06-28 09:35:25,273 [INFO] sqlalchemy.engine.base.Engine: () 2017-06-28 09:35:25,274 INFO sqlalchemy.engine.base.Engine ROLLBACK 2017-06-28 09:35:25,274 [INFO] sqlalchemy.engine.base.Engine: ROLLBACK Traceback (most recent call last): File "/usr/share/pagure/pagure_createdb.py", line 14, in <module> debug=True) File "/usr/lib/python2.7/site-packages/pagure/lib/model.py", line 76, in create_tables BASE.metadata.create_all(engine) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/schema.py", line 3762, in create_all tables=tables) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1856, in _run_visitor conn._run_visitor(visitorcallable, element, **kwargs) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1481, in _run_visitor **kwargs).traverse_single(element) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single return meth(obj, **kw) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 730, in visit_metadata _is_metadata_operation=True) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single return meth(obj, **kw) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 764, in visit_table include_foreign_key_constraints=include_foreign_key_constraints File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection return connection._execute_ddl(self, multiparams, params) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl compiled File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception exc_info File "/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) File "/usr/lib64/python2.7/site-packages/MySQLdb/cursors.py", line 226, in execute self.errorhandler(self, exc, value) File "/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorvalue sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError) (1170, "BLOB/TEXT column 'name' used in key specification without a key length") [SQL: u'\nCREATE TABLE issue_keys (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tproject_id INTEGER NOT NULL, \n\tname TEXT NOT NULL, \n\tkey_type VARCHAR(255) NOT NULL, \n\tkey_data TEXT, \n\tkey_notify BOOL NOT NULL, \n\tCONSTRAINT issue_keys_pkey PRIMARY KEY (id), \n\tCONSTRAINT issue_keys_project_id_key UNIQUE (project_id, name), \n\tCONSTRAINT issue_keys_project_id_fkey FOREIGN KEY(project_id) REFERENCES projects (id) ON DELETE CASCADE ON UPDATE CASCADE, \n\tCHECK (key_notify IN (0, 1))\n)\n\n'] $ alembic -c /etc/pagure/alembic.ini upgrade b5efae6bb23 Using configuration file `/etc/pagure/pagure.cfg` 2017-06-28 09:35:56,085 [INFO] alembic.runtime.migration: Context impl MySQLImpl. 2017-06-28 09:35:56,086 [INFO] alembic.runtime.migration: Will assume non-transactional DDL. 2017-06-28 09:35:56,110 [INFO] alembic.runtime.migration: Running upgrade -> b5efae6bb23, Add merge status to the pull_requests table Traceback (most recent call last): File "/usr/bin/alembic", line 9, in <module> load_entry_point('alembic==0.8.6', 'console_scripts', 'alembic')() File "/usr/lib/python2.7/site-packages/alembic/config.py", line 479, in main CommandLine(prog=prog).main(argv=argv) File "/usr/lib/python2.7/site-packages/alembic/config.py", line 473, in main self.run_cmd(cfg, options) File "/usr/lib/python2.7/site-packages/alembic/config.py", line 456, in run_cmd **dict((k, getattr(options, k)) for k in kwarg) File "/usr/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade script.run_env() File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env util.load_python_file(self.dir, 'env.py') File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file module = load_module_py(module_id, path) File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py mod = imp.load_source(module_id, path, fp) File "/usr/share/pagure/alembic/env.py", line 90, in <module> run_migrations_online() File "/usr/share/pagure/alembic/env.py", line 84, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations self.get_context().run_migrations(**kw) File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 312, in run_migrations step.migration_fn(**kw) File "/usr/share/pagure/alembic/versions/b5efae6bb23_add_merge_status_to_the_pull_requests_.py", line 25, in upgrade enum.create(op.get_bind(), checkfirst=False) File "/usr/lib64/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.py", line 1360, in create bind.execute(CreateEnumType(self)) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection return connection._execute_ddl(self, multiparams, params) File "/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 962, in _execute_ddl compiled = ddl.compile(dialect=dialect) File "<string>", line 1, in <lambda> File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 494, in compile return self._compiler(dialect, bind=bind, **kw) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/ddl.py", line 26, in _compiler return dialect.ddl_compiler(dialect, self, **kw) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 190, in __init__ self.string = self.process(self.statement, **compile_kwargs) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 213, in process return obj._compiler_dispatch(self, **kwargs) File "/usr/lib64/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 79, in _compiler_dispatch raise exc.UnsupportedCompilationError(visitor, cls) sqlalchemy.exc.UnsupportedCompilationError: Compiler <sqlalchemy.dialects.mysql.base.MySQLDDLCompiler object at 0x7f803f5001d0> can't render element of type <class 'sqlalchemy.dialects.postgresql.base.CreateEnumType'>
Metadata Update from @pingou: - Issue tagged with: bug
Commit b6b5f6d relates to this ticket
so there are the steps I followed and got it to work:
Assuming that you have mysql or mariadb installed, I have mariadb running on my machine.
and I ran createdb.py Mariadb version: mariadb-10.1.25-1.fc25.x86_64
Most of the functionalities are working for me.
So the database definition has been fixed, but the alembic migration issue remains. Looking around it seems touching at enums in mysql is a real pain to the point that this migration being over 3 years old now, I doubt it is worth spending time on trying to fix this. However, this means, we really ought to be careful when writing our alembic migrations in the future to avoid ending up in holes like this one.
So I'm going to close this ticket as won't fix, we know of at least one pagure deployed under mysql and so we'll be careful not to break that in the future.
Sorry @pjakma for not fixing this sooner, I'd even say sorry for using ENUM here which is the source of the issue and thanks for your report nonetheless, it is always appreciated.
Metadata Update from @pingou: - Issue close_status updated to: Won't Fix - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.