Coder Social home page Coder Social logo

Comments (2)

feldlime avatar feldlime commented on July 17, 2024 1

I tested it with your setup and it worked.

I did few more tests. Seems that it's not an issue of dbmate, but a ClickHouse issue.

I can reproduce it with ClickHouse 21.8.13, but with the latest versions it works fine.

Closing the issue

from dbmate.

dossy avatar dossy commented on July 17, 2024

I tried to reproduce this with the latest dbmate v2.10 and ClickHouse 22.8.21.38 on Ubuntu 20.04.6 LTS, and could not reproduce with this:

$ mkdir issue_503
$ printf -- '-- migrate:up\ncreate table some_table (some_column int) engine=MergeTree order by some_column;\n-- migrate:down\n' > issue_503/20240105002500_create_table.sql
$ printf -- '-- migrate:up\ncreate view some_view as (select t.some_column from some_table as t);\n-- migrate:down\n' > issue_503/20240105002501_create_view.sql
$ dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 drop
$ dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 -s issue_503/schema.sql up
$ cat issue_503/schema.sql
Output:
root@ac78f31eadc5:/src# mkdir issue_503
root@ac78f31eadc5:/src# printf -- '-- migrate:up\ncreate table some_table (some_column int) engine=MergeTree order by some_column;\n-- migrate:down\n' > issue_503/20240105002500_create_table.sql
root@ac78f31eadc5:/src# printf -- '-- migrate:up\ncreate view some_view as (select t.some_column from some_table as t);\n-- migrate:down\n' > issue_503/20240105002501_create_view.sql
root@ac78f31eadc5:/src# dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 drop
Dropping: dbmate_test
root@ac78f31eadc5:/src# dist/dbmate -u $CLICKHOUSE_TEST_URL -d issue_503 -s issue_503/schema.sql up
Creating: dbmate_test
Applying: 20240105002500_create_table.sql
Applying: 20240105002501_create_view.sql
Writing: issue_503/schema.sql
root@ac78f31eadc5:/src# cat issue_503/schema.sql 
 
--
-- Database schema
--

CREATE DATABASE IF NOT EXISTS dbmate_test;

CREATE TABLE dbmate_test.schema_migrations
(
    `version` String,
    `ts` DateTime DEFAULT now(),
    `applied` UInt8 DEFAULT 1
)
ENGINE = ReplacingMergeTree(ts)
PRIMARY KEY version
ORDER BY version
SETTINGS index_granularity = 8192;

CREATE TABLE dbmate_test.some_table
(
    `some_column` Int32
)
ENGINE = MergeTree
ORDER BY some_column
SETTINGS index_granularity = 8192;

CREATE VIEW dbmate_test.some_view
(
    `some_column` Int32
) AS
SELECT t.some_column
FROM dbmate_test.some_table AS t;


--
-- Dbmate schema migrations
--

INSERT INTO schema_migrations (version) VALUES
    ('20240105002500'),
    ('20240105002501');

If you can provide a minimal reproducible example of the issue, I'll try to see if I can reproduce it.

from dbmate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.