Use comments to show when fixtures were used

Đang mở
#208 1 bình luận 4 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
postgresql, sql, typescript
Lĩnh vực
database, tooling

Hướng nghiên cứu

Truy vết các điểm vào dịch của việc bao gồm fixture và migration bằng các ví dụ current.sql, fixtures/functions/hello.sql và 000001.sql được tạo trong issue. So sánh đầu ra đã commit và đầu ra chưa migration, sau đó xác minh rằng SQL bắt nguồn từ fixture được đánh dấu bằng các chú thích xác định fixture được bao gồm và các ranh giới của nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature description

In experimenting with the new fixture feature, I noticed that:

  1. There is no way to tell in the committed migration that a fixture was used.
  2. When uncommitting a migration that used a fixture, the fixture contents are inlined back into the migration

It seems like it would be useful to include some comments that indicate it came from a fixture. Maybe something like

current.sql:

select 'foo';
--! include functions/hello.sql

fixtures/functions/hello.sql

create or replace function public.hello() returns text as $$
  select 'Hello, world!';
$$ language sql;

translating into 000001.sql

--! Previous: -
--! Hash: sha1:a62f7d32702b880992ad9e2a7753dd977267064a

select 'foo';

--! Included: functions/hello.sql
create or replace function public.hello() returns text as $$
  select 'Hello, world!';
$$ language sql;
--! EndIncluded

I'm not deeply familiar with naming conventions of the !-- comments, so of course feel free to suggest better names

Motivating example

I was messing around with the new fixture features and was curious how it handled unmigrations. Admittedly, unmigrating is not a common thing I do, so it's not a huge deal. But as I thought about it, I came to think that even including a comment in the final migration that the statements came from a fixture is a positive addition to help future readers of migrations understand how the migrations were written.

Breaking changes

It seems like a change like this would only affect migrations going forward, so hopefully no breaking changes for anyone who is already on the 2.0 release candidates.

Supporting development

I:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️ (Just at the "backer" level)
  • have an active support or consultancy contract with Graphile
Ngôn ngữ chính
TypeScript
Star
836
Fork
71
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của graphile/migrate

Tất cả issue của graphile/migrate

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.