cli icon indicating copy to clipboard operation
cli copied to clipboard

Weird output from supabase migration list

Open jide opened this issue 1 year ago • 2 comments

Bug report

  • [X] I confirm this is a bug with Supabase, not with my own application.
  • [X] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

Since I added my last migration, supabase db push gives me this error :

yarn supabase db push                                           (base) 
Enter your database password: 
Connecting to remote database...
Skipping migration .DS_Store... (file name must match pattern "<timestamp>_name.sql")
Remote migration versions not found in supabase/migrations directory.

Make sure your local git repo is up-to-date. If the error persists, try repairing the migration history table:
supabase migration repair --status reverted 20240124010108
supabase migration repair --status reverted 20240126132532
supabase migration repair --status reverted 20240209211500
supabase migration repair --status reverted 20240212162413
supabase migration repair --status reverted 20240212162603
supabase migration repair --status reverted 20240212222038
supabase migration repair --status reverted 20240213214051
supabase migration repair --status reverted 20240214110242
supabase migration repair --status reverted 20240218224939
supabase migration repair --status reverted 20240221105545
supabase migration repair --status reverted 20240306120824
supabase migration repair --status reverted 20240307025144
supabase migration repair --status reverted 20240307211553
supabase migration repair --status reverted 20240307221201
supabase migration repair --status reverted 20240307232740
supabase migration repair --status reverted 20240309000220
supabase migration repair --status reverted 20240309001131
supabase migration repair --status reverted 20240309001958
supabase migration repair --status reverted 20240309002306
supabase migration repair --status reverted 20240309003516
supabase migration repair --status reverted 20240309005410

And update local migrations to match remote database:
supabase db pull

So I ran supabase migration list and it gives me this strange output:

yarn supabase migration list                                      (base) 
Enter your database password: 
Connecting to remote database...

  
        LOCAL      │     REMOTE     │     TIME (UTC)
  ─────────────────┼────────────────┼──────────────────────
    20231204095554 │ 20231204095554 │ 2023-12-04 09:55:54
    20231204095620 │ 20231204095620 │ 2023-12-04 09:56:20
    20231204095625 │ 20231204095625 │ 2023-12-04 09:56:25
    20231204105748 │ 20231204105748 │ 2023-12-04 10:57:48
    20231204105749 │ 20231204105749 │ 2023-12-04 10:57:49
    20231204107450 │ 20231204107450 │      20231204107450
    20231206001219 │ 20231206001219 │ 2023-12-06 00:12:19
    20240108213030 │ 20240108213030 │ 2024-01-08 21:30:30
    20240115215520 │ 20240115215520 │ 2024-01-15 21:55:20
    20240117005220 │ 20240117005220 │ 2024-01-17 00:52:20
    20240117203635 │ 20240117203635 │ 2024-01-17 20:36:35
    20240119130542 │ 20240119130542 │ 2024-01-19 13:05:42
    20240124010105 │ 20240124010105 │ 2024-01-24 01:01:05
                   │ 20240124010108 │ 2024-01-24 01:01:08
    20240126132532 │ 20240126132532 │ 2024-01-26 13:25:32
    20240209211500 │ 20240209211500 │ 2024-02-09 21:15:00
    20240212162413 │ 20240212162413 │ 2024-02-12 16:24:13
    20240212162603 │ 20240212162603 │ 2024-02-12 16:26:03
    20240212222038 │ 20240212222038 │ 2024-02-12 22:20:38
    20240213214051 │ 20240213214051 │ 2024-02-13 21:40:51
    20240214110242 │ 20240214110242 │ 2024-02-14 11:02:42
    20240218224939 │ 20240218224939 │ 2024-02-18 22:49:39
    20240221105545 │ 20240221105545 │ 2024-02-21 10:55:45
    20240306120824 │ 20240306120824 │ 2024-03-06 12:08:24
    20240307025144 │ 20240307025144 │ 2024-03-07 02:51:44
    20240307211553 │ 20240307211553 │ 2024-03-07 21:15:53
    20240307221201 │ 20240307221201 │ 2024-03-07 22:12:01
    20240307232740 │ 20240307232740 │ 2024-03-07 23:27:40
    20240309000220 │ 20240309000220 │ 2024-03-09 00:02:20
    20240309001131 │ 20240309001131 │ 2024-03-09 00:11:31
    20240309001958 │ 20240309001958 │ 2024-03-09 00:19:58
    20240309002306 │ 20240309002306 │ 2024-03-09 00:23:06
    20240309003516 │ 20240309003516 │ 2024-03-09 00:35:16
    20240309005410 │ 20240309005410 │ 2024-03-09 00:54:10
    20240317144212 │                │ 2024-03-17 14:42:12

Not sure how this could happen, but something seems really off in the migration history.

System information

  • OS: macOS
  • Version of supabase: 1.148.6
  • Version of Node.js: 18.18.1

jide avatar Mar 18 '24 21:03 jide

This is due to a missing file in your local supabase/migrations directory, namely 20240124010108_<name>.sql.

Did you happen to accidentally delete it because the record exists on your remote database.

The suggested command should be just supabase migration repair --status reverted 20240124010108.

sweatybridge avatar Mar 19 '24 09:03 sweatybridge

Thank you, indeed that fixed the issue.

That said, I still find the output of migration list strange. Why is there a timestamp column displayed as raw value ?

Maybe it's just a date parsing issue ?

Even after the fix, I can still see this :


  
        LOCAL      │     REMOTE     │     TIME (UTC)
  ─────────────────┼────────────────┼──────────────────────
    20231204095554 │ 20231204095554 │ 2023-12-04 09:55:54
    20231204095620 │ 20231204095620 │ 2023-12-04 09:56:20
    20231204095625 │ 20231204095625 │ 2023-12-04 09:56:25
    20231204105748 │ 20231204105748 │ 2023-12-04 10:57:48
    20231204105749 │ 20231204105749 │ 2023-12-04 10:57:49
    20231204107450 │ 20231204107450 │      20231204107450
    20231206001219 │ 20231206001219 │ 2023-12-06 00:12:19
    20240108213030 │ 20240108213030 │ 2024-01-08 21:30:30
    20240115215520 │ 20240115215520 │ 2024-01-15 21:55:20
    20240117005220 │ 20240117005220 │ 2024-01-17 00:52:20
    20240117203635 │ 20240117203635 │ 2024-01-17 20:36:35
    20240119130542 │ 20240119130542 │ 2024-01-19 13:05:42
    20240124010105 │ 20240124010105 │ 2024-01-24 01:01:05
    20240126132532 │ 20240126132532 │ 2024-01-26 13:25:32
    20240209211500 │ 20240209211500 │ 2024-02-09 21:15:00
    20240212162413 │ 20240212162413 │ 2024-02-12 16:24:13
    20240212162603 │ 20240212162603 │ 2024-02-12 16:26:03
    20240212222038 │ 20240212222038 │ 2024-02-12 22:20:38
    20240213214051 │ 20240213214051 │ 2024-02-13 21:40:51
    20240214110242 │ 20240214110242 │ 2024-02-14 11:02:42
    20240218224939 │ 20240218224939 │ 2024-02-18 22:49:39
    20240221105545 │ 20240221105545 │ 2024-02-21 10:55:45
    20240306120824 │ 20240306120824 │ 2024-03-06 12:08:24
    20240307025144 │ 20240307025144 │ 2024-03-07 02:51:44
    20240307211553 │ 20240307211553 │ 2024-03-07 21:15:53
    20240307221201 │ 20240307221201 │ 2024-03-07 22:12:01
    20240307232740 │ 20240307232740 │ 2024-03-07 23:27:40
    20240309000220 │ 20240309000220 │ 2024-03-09 00:02:20
    20240309001131 │ 20240309001131 │ 2024-03-09 00:11:31
    20240309001958 │ 20240309001958 │ 2024-03-09 00:19:58
    20240309002306 │ 20240309002306 │ 2024-03-09 00:23:06
    20240309003516 │ 20240309003516 │ 2024-03-09 00:35:16
    20240309005410 │ 20240309005410 │ 2024-03-09 00:54:10
    20240317144212 │ 20240317144212 │ 2024-03-17 14:42:12
    20240319104544 │ 20240319104544 │ 2024-03-19 10:45:44

jide avatar Mar 19 '24 10:03 jide

Why is there a timestamp column displayed as raw value ?

This happens because the minute value in this row 20231204107450 is 74 which is not a valid timestamp.

sweatybridge avatar Mar 22 '24 07:03 sweatybridge

Ohhhh damn ! Probably a date I manually edited.

jide avatar Mar 22 '24 08:03 jide