saleor / saleor-platform

All Saleor services started from a single repository with docker-compose.
BSD 3-Clause "New" or "Revised" License
650 stars 889 forks source link

Db populate data error #70

Closed deepinder10 closed 2 years ago

deepinder10 commented 4 years ago

Hi, I am getting this error when I try to populate my database with example store and create a user

django.db.utils.ProgrammingError: column "meta" of relation "shipping_shippingmethod" does not exist

krzysztofwolski commented 4 years ago

Are you using a customized code? Whats your operating system? I cannot reproduce this issue without context. Check connection with database container. Maybe u had some old postgress instance running. In such case remove it and other containers and follow instructions again.

v3ss0n commented 4 years ago

same thing happening after wipe and reinstall

cernalue commented 3 years ago

Same thing happening. Any solution?

Nenu1985 commented 3 years ago

Had the same issue after upgrading repositories and trying to rebuild containers. Solution: remove old container volumes and rerun containers.

AhmadManzoor commented 2 years ago

i am getting the same error

  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedColumn: column page_page.publication_date does not exist
LINE 1: SELECT "page_page"."id", "page_page"."publication_date", "pa...
                                 ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/app/saleor/core/management/commands/populatedb.py", line 97, in handle
    for msg in create_pages():
  File "/app/saleor/core/utils/random_data.py", line 1597, in create_pages
    page, _ = Page.objects.get_or_create(
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 581, in get_or_create
    return self.get(**kwargs), False
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 431, in get
    num = len(clone)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 262, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1324, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column page_page.publication_date does not exist
LINE 1: SELECT "page_page"."id", "page_page"."publication_date", "pa...
                                 ^

what <i have tried: made sure delete any container and rebuild migrate before populatedb different checkouts of saleor repository

magul commented 2 years ago

@AhmadManzoor your problem looks different than the one described by @deepinder10.

It looks you never run Django migrations, have you run docker-compose run --rm api python3 manage.py migrate (see: https://github.com/saleor/saleor-platform#with-docker-steps)

AhmadManzoor commented 2 years ago

yes as I have mentioned I have already tried these things

magul commented 2 years ago

Have you also removed volumes?

(if that's the only docker project that work on on your machine you can simply remove them via docker volume rm $(docker volume ls -q))

AhmadManzoor commented 2 years ago

Yes I have also removed all volumes already. There is no container now not even a single one.

magul commented 2 years ago

@AhmadManzoor please provide output of:

assuming everything will be fine there, please also provide list of command that you run and please provide information, when this particular error occurs?

AhmadManzoor commented 2 years ago

my branch is at https://github.com/saleor/saleor-platform/tree/530229ad6b4294cd71f11c62b0d97255ecd567e2 (because main was having some other issues)

git status:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)
    modified:   backend.env
    modified:   react-storefront (modified content)

git submodule status

 f5c6992d549f2a848248d5ab1152b324c840753b react-storefront (1.0.0~75)
 d9bec4e9b8898b4728176caa06764a1101761118 saleor (3.1.9)
 d304a5d376dc68bef80e4eeffe7a0b70f27d89e6 saleor-dashboard (3.1.5-1-gd304a5d37)

docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES docker images

REPOSITORY                         TAG           IMAGE ID       CREATED         SIZE
<none>                             <none>        695ff84743db   3 hours ago     915MB
saleor-platform_api                latest        18b906133af5   3 hours ago     961MB
saleor-platform_worker             latest        18b906133af5   3 hours ago     961MB
<none>                             <none>        f95af1b887b3   13 hours ago    974MB
<none>                             <none>        9085d88dd941   13 hours ago    1.68GB
<none>                             <none>        95883e46a59d   13 hours ago    987MB
<none>                             <none>        fea4ce922897   14 hours ago    952MB
<none>                             <none>        e5105162a03b   14 hours ago    1.7GB
<none>                             <none>        1e73bfc9ad3a   14 hours ago    952MB
jaegertracing/all-in-one           latest        99132036deb8   14 hours ago    60.4MB
saleor-platform_storefront         latest        661a1073aefa   14 hours ago    2.68GB
<none>                             <none>        4c8da1f7ad3f   14 hours ago    952MB
<none>                             <none>        f6cb8545ddf4   14 hours ago    1.7GB
<none>                             <none>        3c256a24ad62   14 hours ago    2.19GB
<none>                             <none>        1cddeb756a0c   15 hours ago    986MB
<none>                             <none>        00f1e80174fd   15 hours ago    1.94GB
<none>                             <none>        d67266d3e0c3   15 hours ago    986MB
<none>                             <none>        01392d08a844   15 hours ago    1.68GB
<none>                             <none>        f91c349e8cae   16 hours ago    2.2GB
<none>                             <none>        0b78ec9f8590   16 hours ago    987MB
<none>                             <none>        44233c8f4dfc   16 hours ago    1.68GB
<none>                             <none>        7c3ec4f623d6   19 hours ago    1.65GB
<none>                             <none>        cbe96ff612a2   19 hours ago    2.36GB
<none>                             <none>        bc3ca9211f83   20 hours ago    1.44GB
<none>                             <none>        639e9a2f5d66   20 hours ago    1.45GB
<none>                             <none>        7dc708ad6e58   20 hours ago    2.51GB
<none>                             <none>        5cb3d95ab557   21 hours ago    1.43GB
<none>                             <none>        16b6866da764   21 hours ago    1.43GB
<none>                             <none>        f2fd5cd630be   21 hours ago    2.41GB
<none>                             <none>        dba3ebdb4182   21 hours ago    1.39GB
saelordashboard                    latest        e08aed6d6587   22 hours ago    2.41GB
<none>                             <none>        a023fb033a48   25 hours ago    1.39GB
<none>                             <none>        1e91273e2c49   36 hours ago    1.39GB
<none>                             <none>        07f5c8c79b4a   36 hours ago    1.39GB
<none>                             <none>        7205c3ef6345   36 hours ago    961MB
<none>                             <none>        88e12ce1103a   36 hours ago    1.39GB
<none>                             <none>        62c0996d7c9b   37 hours ago    1.39GB
<none>                             <none>        65397e084c02   37 hours ago    961MB
saleor-platform_react-storefront   latest        9a3be1f3e037   37 hours ago    1.29GB
<none>                             <none>        1354bee209be   37 hours ago    974MB
<none>                             <none>        cea2a7ca9068   38 hours ago    968MB
<none>                             <none>        9c1d7d067e91   38 hours ago    961MB
<none>                             <none>        2ad3ef1291eb   38 hours ago    1.7GB
saleor-platform_dashboard          latest        dcf284b0f20b   38 hours ago    2.21GB
python                             3.9-slim      34c734948d13   2 days ago      125MB
python                             3.9           b673851840e8   2 days ago      915MB
jaegertracing/all-in-one           <none>        f46e44f0bbdb   2 days ago      60.4MB
postgres                           13-alpine     c30ed787c4dc   10 days ago     213MB
redis                              5.0-alpine    2bfeb9a4412a   10 days ago     23MB
node                               14            326f034bd14b   2 weeks ago     914MB
node                               16            c6b745e900c7   2 weeks ago     907MB
node                               10            28dca6642db8   15 months ago   910MB
mailhog/mailhog                    latest        4de68494cd0d   23 months ago   392MB
postgres                           11.1-alpine   b43856647ab5   3 years ago     70.8MB

docker volume ls

DRIVER    VOLUME NAME
local     0fbf83aa738eca7330f7f29486ec420c65312e6b2809c15d2dbffc81a74e84d8
local     2a8bf6eac0936a9b4f7c98cdd23e7d93a218650f0d7ff858397417ee0013ffb5
local     4c93c83f0bf8cd373695f8afef2254ce47e7b1cc99ab709f37b30de0d51bc235
local     9f4517e267c80cda22cced9c25f161cd78ca6bf5bcab220991fd34b22028367d
local     043c49da5f5f0020bc08fff55cfb1782136cffa82af838902b40aa7bec33194a
local     91c8cb0ac61cfe47b2d2ac91ca47c04a9f798c0b96eaa5c87d3a33e72c4b6323
local     384bb737a1748c3fd3a5fe002d83840960ee4582d2c915877f9b8121e559a80f
local     612cea6cb4e32745f554953a0443a3a485de0c0a6433d7831f3cb0686d11e8d8
local     725f52acd2ba21fdcc3a5ce4072b00f1f9b0c33928e7cc8bfa3792fc2297d938
local     761ae7957be0a9f4ec0c7cab7ece03a4e90946b4b2a6ca52fc01fe90780f0525
local     3785356be212a4c3aa023221deb194e04982e956b33bc43e0c43efc2c2ab5f88
local     a46f5f5f6d1f5ff14de8268fa6c518f21b5b6b5b29891429b54f01ca3551eafa
local     b0d99657d4be12e10d635783f923b5bf9bd0636c1efc2ff34ce88f52682ec7f7
local     b4f868b67b1b85fedc25b496ab21d8730513d1464e8bcc4b6a47bb4cff9321b1
local     bb8d5b79918fb4fa40f17ef673d20edceb3ecaee7af776d614c2252c1ed706b2
local     c386f789ff9b94ace444b330dfb6bf09460b1670e4a8f13eb1313afb54d1e484
local     d5ec02eaabcbc85fcdd4e176547d8bec7c189314a4b9d86d9bcda747a0d3ac5f
local     df2e8ea0ae15b152e69d70b734eafe455ac26b10cf56cbf81b1430dbd5655aac
local     f5978f74ddce7abae119784fd37865ce8ba63eaeff77910a9263677a255c1ad0
local     fdeea4e6acec753a34ffd4c7f8303f54eb0bd2406bc1ea10728f48ce9edd4842
local     saleor-platform_saleor-db
local     saleor-platform_saleor-media
local     saleor-platform_saleor-redis
AhmadManzoor commented 2 years ago

tried after sudo docker volume rm $(sudo docker volume ls)

it worked. thanks for the clue :) as a last thing can you please recommend. stable and compatible version for all 4 repos? and any proper guide for production deployment on custom server. Thanks again

magul commented 2 years ago

as a last thing can you please recommend. stable and compatible version for all 4 repos?

Core and Dashboard are periodically released and we try to have them work together and be stable. 3rd repo, I guess, is storefront - currently it's not released with core/dashboard release cycle; we're talking about that, but don't know how, when and if it will happened. Don't know to what you refer, when talking about 4th repository.

and any proper guide for production deployment on custom server.

We had actually small discussion about that today's morning. Don't know yet if it will be delivered exactly and what shape will that take?

CC @lkostrowski @peelar

AhmadManzoor commented 2 years ago

I have deployed it finally. I would love to assist in anyway if I could. For making a stable version to be deployed on production.

lkostrowski commented 2 years ago

Hi @AhmadManzoor

I'd love to hear more about your project and use case.

Keep in mind, that at the moment saleor-platform setup is meant for local development.

At the moment we have Saleor Cloud as SaaS version, but we'd like to support more on-premise deployments to any infrastructure.

We are working on a proposal on how this can be achieved. Can you share your thoughts - what was your experience with deployment, where did you deploy, and how can Saleor help to make this more seamless?