[ckan-dev] Migrations from 2.2.2 to 2.5.2

Luiz Felipe Fernandes Machado Costa thenets.org at gmail.com
Tue Sep 20 19:48:52 UTC 2016


I don't know why, but everything is ok now! :D

I ran the command "paster search-index rebuild
--config=/etc/ckan/std/std.ini" after the "paster db upgrade" and every
dataset was showed! :D

õ/ Thanks!

Em ter, 20 de set de 2016 às 16:37, Luiz Felipe Fernandes Machado Costa <
thenets.org at gmail.com> escreveu:

> Hi, Ian.
>
> I tried to use this command, but return an error :/
>
> Traceback (most recent call last):
>   File "/usr/lib/ckan/default/bin/paster", line 11, in <module>
>     sys.exit(run())
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py",
> line 102, in run
>     invoke(command, command_name, options, args[1:])
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py",
> line 141, in invoke
>     exit_code = runner.run(args)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py",
> line 236, in run
>     result = self.command()
>   File "/usr/lib/ckan/default/src/ckan/ckan/lib/cli.py", line 232, in
> command
>     model.repo.upgrade_db()
>   File "/usr/lib/ckan/default/src/ckan/ckan/model/__init__.py", line 287,
> in upgrade_db
>     mig.upgrade(self.metadata.bind, self.migrate_repository,
> version=version)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/api.py",
> line 186, in upgrade
>     return _migrate(url, repository, version, upgrade=True, err=err,
> **opts)
>   File "<decorator-gen-16>", line 2, in _migrate
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/util/__init__.py",
> line 160, in with_engine
>     return f(*a, **kw)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/api.py",
> line 366, in _migrate
>     schema.runchange(ver, change, changeset.step)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/schema.py",
> line 93, in runchange
>     change.run(self.engine, step)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/migrate/versioning/script/py.py",
> line 148, in run
>     script_func(engine)
>   File
> "/usr/lib/ckan/default/src/ckan/ckan/migration/versions/074_remove_resource_groups.py",
> line 28, in upgrade
>     '''
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 1690, in execute
>     return connection.execute(statement, *multiparams, **params)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 719, in execute
>     return self._execute_text(object, multiparams, params)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 868, in _execute_text
>     statement, parameters
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 954, in _execute_context
>     context)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 1116, in _handle_dbapi_exception
>     exc_info
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py",
> line 189, in raise_from_cause
>     reraise(type(exception), exception, tb=exc_tb)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py",
> line 947, in _execute_context
>     context)
>   File
> "/usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py",
> line 435, in do_execute
>     cursor.execute(statement, parameters)
> sqlalchemy.exc.ProgrammingError: (ProgrammingError) column "package_id" of
> relation "resource" already exists
>  '\n        ALTER TABLE "resource"\n            ADD COLUMN "package_id"
> text NOT NULL DEFAULT \'\';\n        UPDATE "resource" AS R\n        SET
> package_id = G.package_id\n        FROM "resource_group" AS G\n
> WHERE R.resource_group_id = G.id;\n        ALTER TABLE "resource" DROP
> COLUMN "resource_group_id";\n\n        ALTER TABLE
> "resource_revision"\n            ADD COLUMN "package_id" text NOT NULL
> DEFAULT \'\';\n        UPDATE "resource_revision" AS R\n        SET
> package_id = G.package_id\n        FROM "resource_group_revision" AS
> G\n        WHERE R.resource_group_id = G.id;\n        ALTER TABLE
> "resource_revision" DROP COLUMN "resource_group_id";\n\n        ALTER TABLE
> resource_group_revision\n            DROP CONSTRAINT
> resource_group_revision_continuity_id_fkey;\n\n        DROP TABLE
> "resource_group_revision";\n        DROP TABLE "resource_group";\n        '
> {}
>
>
>
> Em ter, 20 de set de 2016 às 15:43, Ian Ward <ian at excess.org> escreveu:
>
>> Hi Luiz,
>>
>> try
>> http://docs.ckan.org/en/latest/maintaining/database-management.html#upgrading
>>
>> On Tue, Sep 20, 2016 at 2:00 PM, Luiz Felipe Fernandes Machado Costa
>> <thenets.org at gmail.com> wrote:
>> > Hi,
>> >
>> > Where can I find all database migrations to update my CKAN database from
>> > 2.2.2 to 2.5.2?
>> >
>> > Thanks.
>> > --
>> > Luiz Felipe F M Costa
>> > Full Stack Developer
>> > http://TheNets.org
>> >
>> > _______________________________________________
>> > ckan-dev mailing list
>> > ckan-dev at lists.okfn.org
>> > https://lists.okfn.org/mailman/listinfo/ckan-dev
>> > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>> >
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
> --
> Luiz Felipe F M Costa
> Full Stack Developer
> http://TheNets.org
>
-- 
Luiz Felipe F M Costa
Full Stack Developer
http://TheNets.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160920/9479434d/attachment-0003.html>


More information about the ckan-dev mailing list