@_nazmiforreal/flutter-ota 0.1.13 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/bin/flutter-ota-linux-x64 +0 -0
  2. package/bin/flutter-ota.js +23 -72
  3. package/dart-src/packages/cli-tools/.dart_tool/package_config.json +0 -2
  4. package/dart-src/packages/cli-tools/.dart_tool/package_graph.json +6 -6
  5. package/dart-src/packages/cli-tools/lib/flutter_ota_kit_cli.dart +2 -2
  6. package/dart-src/packages/cli-tools/lib/src/commands/build.dart +1 -1
  7. package/dart-src/packages/cli-tools/lib/src/commands/bundle.dart +112 -124
  8. package/dart-src/packages/cli-tools/lib/src/commands/channel.dart +20 -28
  9. package/dart-src/packages/cli-tools/lib/src/commands/config_command.dart +40 -18
  10. package/dart-src/packages/cli-tools/lib/src/commands/console.dart +10 -11
  11. package/dart-src/packages/cli-tools/lib/src/commands/deploy.dart +30 -33
  12. package/dart-src/packages/cli-tools/lib/src/commands/doctor.dart +43 -41
  13. package/dart-src/packages/cli-tools/lib/src/commands/fingerprint.dart +9 -10
  14. package/dart-src/packages/cli-tools/lib/src/commands/init.dart +32 -35
  15. package/dart-src/packages/cli-tools/lib/src/commands/keys.dart +3 -6
  16. package/dart-src/packages/cli-tools/lib/src/commands/migrate.dart +59 -50
  17. package/dart-src/packages/cli-tools/lib/src/commands/pocketbase.dart +32 -37
  18. package/dart-src/packages/cli-tools/lib/src/commands/rollback.dart +13 -16
  19. package/dart-src/packages/cli-tools/lib/src/commands/storage.dart +12 -20
  20. package/dart-src/packages/cli-tools/lib/src/config.dart +10 -3
  21. package/dart-src/packages/cli-tools/lib/src/operations.dart +5 -0
  22. package/dart-src/packages/cli-tools/lib/src/ui/ui.dart +225 -31
  23. package/dart-src/packages/cli-tools/lib/src/util.dart +7 -3
  24. package/dart-src/packages/cli-tools/pubspec.lock +6 -6
  25. package/dart-src/packages/cli-tools/test/cli_test.dart +6 -0
  26. package/dart-src/packages/core/CHANGELOG.md +9 -0
  27. package/dart-src/packages/core/pubspec.yaml +1 -1
  28. package/dart-src/plugins/aws/CHANGELOG.md +10 -1
  29. package/dart-src/plugins/aws/pubspec.yaml +3 -3
  30. package/dart-src/plugins/cloudflare/CHANGELOG.md +9 -1
  31. package/dart-src/plugins/cloudflare/pubspec.yaml +3 -3
  32. package/dart-src/plugins/plugin-core/CHANGELOG.md +12 -14
  33. package/dart-src/plugins/plugin-core/pubspec.yaml +2 -2
  34. package/dart-src/plugins/pocketbase/pubspec.yaml +2 -2
  35. package/dart-src/plugins/postgres/CHANGELOG.md +13 -3
  36. package/dart-src/plugins/postgres/pubspec.yaml +3 -3
  37. package/dart-src/plugins/supabase/CHANGELOG.md +14 -11
  38. package/dart-src/plugins/supabase/pubspec.yaml +3 -3
  39. package/dart-src/plugins/supabase/supabase/migrations/20250103114225_init.sql +7 -3
  40. package/dart-src/plugins/supabase/supabase/migrations/20250314000000_hot-updater_0.13.0.sql +7 -4
  41. package/dart-src/plugins/supabase/supabase/migrations/20250516000000_hot-updater_0.18.0.sql +18 -6
  42. package/dart-src/plugins/supabase/supabase/migrations/20251014000000_hot-updater_0.21.0.sql +4 -2
  43. package/dart-src/plugins/supabase/supabase/migrations/20260401000000_hot-updater_0.29.0.sql +4 -2
  44. package/dart-src/plugins/supabase/supabase/migrations/20260520014100_hot-updater_rls.sql +22 -6
  45. package/migrations/supabase/20250103114225_init.sql +7 -3
  46. package/migrations/supabase/20250314000000_hot-updater_0.13.0.sql +7 -4
  47. package/migrations/supabase/20250516000000_hot-updater_0.18.0.sql +18 -6
  48. package/migrations/supabase/20251014000000_hot-updater_0.21.0.sql +4 -2
  49. package/migrations/supabase/20260401000000_hot-updater_0.29.0.sql +4 -2
  50. package/migrations/supabase/20260520014100_hot-updater_rls.sql +22 -6
  51. package/package.json +1 -1
  52. package/scripts/vendor.sh +32 -0
  53. package/migrations/aws/README.md +0 -7
  54. package/migrations/cloudflare/bundles.sql +0 -42
@@ -1,9 +1,19 @@
1
- ## 0.1.1
1
+ ## 0.1.3
2
+
3
+ - Add dartdoc on internal API surfaces (10/10 pana dartdoc coverage).
4
+
5
+ ## 0.1.2
2
6
 
3
- - Add `PostgresBundleRow` + `mapRowToBundle` exports for writing custom
4
- server tooling on top of `flutter_ota_kit`.
7
+ - Add `PostgresBundleRow` + `mapRowToBundle` exports for writing custom server
8
+ tooling on top of `flutter_ota_kit_postgres`.
5
9
  - Repository moved to `https://github.com/HYPER12755/flutter-ota-kit`.
6
10
 
11
+ ## 0.1.1
12
+
13
+ - Throw a clear `StateError` from `getDownloadUrl` when no `servingBaseUrl`
14
+ is configured (previously the URL silently failed).
15
+ - Remove dead `IS NULL` filter paths in `_buildWhere`.
16
+
7
17
  ## 0.1.0
8
18
 
9
19
  - Initial release of `flutter_ota_kit_postgres` as part of the flutter_ota_kit OTA toolkit.
@@ -1,6 +1,6 @@
1
1
  name: flutter_ota_kit_postgres
2
2
  description: Postgres plugin for flutter_ota_kit — database backend.
3
- version: 0.1.2
3
+ version: 0.1.3
4
4
  homepage: https://github.com/HYPER12755/flutter-ota-kit
5
5
  repository: https://github.com/HYPER12755/flutter-ota-kit
6
6
  issue_tracker: https://github.com/HYPER12755/flutter-ota-kit/issues
@@ -11,8 +11,8 @@ environment:
11
11
  sdk: ">=3.13.2 <4.0.0"
12
12
 
13
13
  dependencies:
14
- flutter_ota_kit_core: ^0.1.1
15
- flutter_ota_kit_plugin_core: ^0.0.3
14
+ flutter_ota_kit_core: ^0.1.2
15
+ flutter_ota_kit_plugin_core: ^0.0.4
16
16
  postgres: ^3.4.0
17
17
 
18
18
  dev_dependencies:
@@ -1,19 +1,22 @@
1
- ## 0.1.2
1
+ ## 0.1.4
2
+
3
+ - Add dartdoc on internal API surfaces (10/10 pana dartdoc coverage).
4
+
5
+ ## 0.1.3
2
6
 
3
- ### Changed
7
+ - Export `SupabaseBundleRow` and `mapRowToBundle` for writing custom server
8
+ tooling on top of `flutter_ota_kit_supabase`.
9
+ - Repository moved to `https://github.com/HYPER12755/flutter-ota-kit`.
10
+
11
+ ## 0.1.2
4
12
 
5
- - **De-duplicated the error-to-message helper.** `_getErrorMessage` (supabase_storage,
6
- supabase_signed_url_batcher) and `_errorToString` (supabase_edge_function_storage)
7
- were byte-identical copies. They now all call one shared `errorMessage(Object?)` in
8
- `lib/src/error_message.dart`. No behavior change; the internal names are gone.
13
+ - Add edge-function database + storage variants (`supabaseEdgeFunctionDatabase`,
14
+ `supabaseEdgeFunctionStorage`).
15
+ - Add `createSupabaseSignedUrlBatcher` for signed-URL time-bounded downloads.
9
16
 
10
17
  ## 0.1.1
11
18
 
12
- - fix(supabase): the `migrate` RLS migration now creates the public-read policies
13
- (`allow public read bundles`, `allow public read bundle_patches`, `public bundles read`)
14
- so the anon-key app can actually fetch bundles. Previously RLS was enabled with zero
15
- policies, so every fresh `flutter-ota migrate supabase` produced a DB where clients
16
- received no OTA.
19
+ - Initial test release of the Supabase storage plugin.
17
20
 
18
21
  ## 0.1.0
19
22
 
@@ -1,6 +1,6 @@
1
1
  name: flutter_ota_kit_supabase
2
2
  description: Supabase plugin for flutter_ota_kit — database + storage backends.
3
- version: 0.1.3
3
+ version: 0.1.4
4
4
  homepage: https://github.com/HYPER12755/flutter-ota-kit
5
5
  repository: https://github.com/HYPER12755/flutter-ota-kit
6
6
  issue_tracker: https://github.com/HYPER12755/flutter-ota-kit/issues
@@ -11,8 +11,8 @@ environment:
11
11
  sdk: ">=3.13.2 <4.0.0"
12
12
 
13
13
  dependencies:
14
- flutter_ota_kit_core: ^0.1.1
15
- flutter_ota_kit_plugin_core: ^0.0.3
14
+ flutter_ota_kit_core: ^0.1.2
15
+ flutter_ota_kit_plugin_core: ^0.0.4
16
16
  http: ^1.2.0
17
17
  supabase: ^2.14.0
18
18
 
@@ -1,8 +1,12 @@
1
1
  -- HotUpdater.bundles
2
2
 
3
- CREATE TYPE platforms AS ENUM ('ios', 'android');
3
+ DO $$ BEGIN
4
+ CREATE TYPE platforms AS ENUM ('ios', 'android');
5
+ EXCEPTION
6
+ WHEN duplicate_object THEN NULL;
7
+ END $$;
4
8
 
5
- CREATE TABLE bundles (
9
+ CREATE TABLE IF NOT EXISTS bundles (
6
10
  id uuid PRIMARY KEY,
7
11
  platform platforms NOT NULL,
8
12
  target_app_version text NOT NULL,
@@ -14,7 +18,7 @@ CREATE TABLE bundles (
14
18
  message text
15
19
  );
16
20
 
17
- CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
21
+ CREATE INDEX IF NOT EXISTS bundles_target_app_version_idx ON bundles(target_app_version);
18
22
 
19
23
 
20
24
  -- HotUpdater.get_update_info
@@ -88,10 +88,13 @@ $$;
88
88
 
89
89
  -- HotUpdater.bundles
90
90
  ALTER TABLE bundles
91
- ADD COLUMN channel text NOT NULL DEFAULT 'production';
91
+ ADD COLUMN IF NOT EXISTS channel text NOT NULL DEFAULT 'production';
92
92
 
93
- ALTER TABLE bundles
94
- DROP COLUMN file_url;
93
+ DO $$ BEGIN
94
+ ALTER TABLE bundles DROP COLUMN file_url;
95
+ EXCEPTION
96
+ WHEN undefined_column THEN NULL;
97
+ END $$;
95
98
 
96
99
  -- HotUpdater.get_target_app_version_list
97
100
 
@@ -131,4 +134,4 @@ BEGIN
131
134
  END;
132
135
  $$;
133
136
 
134
- CREATE INDEX bundles_channel_idx ON bundles(channel);
137
+ CREATE INDEX IF NOT EXISTS bundles_channel_idx ON bundles(channel);
@@ -8,14 +8,26 @@ UPDATE bundles
8
8
  SET storage_uri = 'supabase-storage://%%BUCKET_NAME%%/' || id || '/bundle.zip'
9
9
  WHERE storage_uri IS NULL;
10
10
 
11
- ALTER TABLE bundles ALTER COLUMN storage_uri SET NOT NULL;
12
- ALTER TABLE bundles ALTER COLUMN target_app_version DROP NOT NULL;
11
+ DO $$ BEGIN
12
+ ALTER TABLE bundles ALTER COLUMN storage_uri SET NOT NULL;
13
+ EXCEPTION
14
+ WHEN null_value_not_allowed THEN NULL;
15
+ END $$;
16
+ DO $$ BEGIN
17
+ ALTER TABLE bundles ALTER COLUMN target_app_version DROP NOT NULL;
18
+ EXCEPTION
19
+ WHEN null_value_not_allowed THEN NULL;
20
+ END $$;
13
21
 
14
- ALTER TABLE bundles ADD CONSTRAINT check_version_or_fingerprint CHECK (
15
- (target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
16
- );
22
+ DO $$ BEGIN
23
+ ALTER TABLE bundles ADD CONSTRAINT check_version_or_fingerprint CHECK (
24
+ (target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
25
+ );
26
+ EXCEPTION
27
+ WHEN duplicate_object THEN NULL;
28
+ END $$;
17
29
 
18
- CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
30
+ CREATE INDEX IF NOT EXISTS bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
19
31
 
20
32
  DROP FUNCTION IF EXISTS get_update_info;
21
33
 
@@ -1,5 +1,7 @@
1
- DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
2
- DROP FUNCTION IF EXISTS get_update_info_by_app_version;
1
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
2
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
3
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
4
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
3
5
 
4
6
  -- HotUpdater.get_update_info
5
7
  CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
@@ -251,7 +251,8 @@ $$;
251
251
 
252
252
  -- HotUpdater.get_update_info_by_fingerprint_hash
253
253
 
254
- DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
254
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
255
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
255
256
 
256
257
  CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
257
258
  app_platform platforms,
@@ -377,7 +378,8 @@ $$;
377
378
 
378
379
  -- HotUpdater.get_update_info_by_app_version
379
380
 
380
- DROP FUNCTION IF EXISTS get_update_info_by_app_version;
381
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
382
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
381
383
 
382
384
  CREATE OR REPLACE FUNCTION get_update_info_by_app_version (
383
385
  app_platform platforms,
@@ -1,7 +1,11 @@
1
1
  -- HotUpdater.supabase_rls
2
2
 
3
3
  ALTER TABLE public.bundles ENABLE ROW LEVEL SECURITY;
4
- ALTER TABLE public.bundle_patches ENABLE ROW LEVEL SECURITY;
4
+ DO $$ BEGIN
5
+ ALTER TABLE public.bundle_patches ENABLE ROW LEVEL SECURITY;
6
+ EXCEPTION
7
+ WHEN undefined_table THEN NULL;
8
+ END $$;
5
9
 
6
10
  ALTER FUNCTION public.get_target_app_version_list(public.platforms, uuid)
7
11
  SET search_path = public, pg_catalog;
@@ -50,10 +54,22 @@ ALTER FUNCTION public.get_update_info_by_app_version(
50
54
  -- OTA update checks are unauthenticated by design (the device only carries the
51
55
  -- anon key), so bundle metadata must be publicly readable. hot-updater's hosted
52
56
  -- Supabase flow relies on these policies existing.
53
- CREATE POLICY "allow public read bundles" ON public.bundles FOR SELECT USING (true);
54
- CREATE POLICY "allow public read bundle_patches" ON public.bundle_patches FOR SELECT USING (true);
57
+ DO $$ BEGIN
58
+ CREATE POLICY "allow public read bundles" ON public.bundles FOR SELECT USING (true);
59
+ EXCEPTION
60
+ WHEN duplicate_object THEN NULL;
61
+ END $$;
62
+ DO $$ BEGIN
63
+ CREATE POLICY "allow public read bundle_patches" ON public.bundle_patches FOR SELECT USING (true);
64
+ EXCEPTION
65
+ WHEN duplicate_object THEN NULL;
66
+ END $$;
55
67
 
56
68
  -- Allow anon/authenticated to resolve signed download URLs for the bundles bucket.
57
- CREATE POLICY "public bundles read" ON storage.objects
58
- FOR SELECT TO anon, authenticated
59
- USING (bucket_id = 'bundles');
69
+ DO $$ BEGIN
70
+ CREATE POLICY "public bundles read" ON storage.objects
71
+ FOR SELECT TO anon, authenticated
72
+ USING (bucket_id = 'bundles');
73
+ EXCEPTION
74
+ WHEN duplicate_object THEN NULL;
75
+ END $$;
@@ -1,8 +1,12 @@
1
1
  -- HotUpdater.bundles
2
2
 
3
- CREATE TYPE platforms AS ENUM ('ios', 'android');
3
+ DO $$ BEGIN
4
+ CREATE TYPE platforms AS ENUM ('ios', 'android');
5
+ EXCEPTION
6
+ WHEN duplicate_object THEN NULL;
7
+ END $$;
4
8
 
5
- CREATE TABLE bundles (
9
+ CREATE TABLE IF NOT EXISTS bundles (
6
10
  id uuid PRIMARY KEY,
7
11
  platform platforms NOT NULL,
8
12
  target_app_version text NOT NULL,
@@ -14,7 +18,7 @@ CREATE TABLE bundles (
14
18
  message text
15
19
  );
16
20
 
17
- CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
21
+ CREATE INDEX IF NOT EXISTS bundles_target_app_version_idx ON bundles(target_app_version);
18
22
 
19
23
 
20
24
  -- HotUpdater.get_update_info
@@ -88,10 +88,13 @@ $$;
88
88
 
89
89
  -- HotUpdater.bundles
90
90
  ALTER TABLE bundles
91
- ADD COLUMN channel text NOT NULL DEFAULT 'production';
91
+ ADD COLUMN IF NOT EXISTS channel text NOT NULL DEFAULT 'production';
92
92
 
93
- ALTER TABLE bundles
94
- DROP COLUMN file_url;
93
+ DO $$ BEGIN
94
+ ALTER TABLE bundles DROP COLUMN file_url;
95
+ EXCEPTION
96
+ WHEN undefined_column THEN NULL;
97
+ END $$;
95
98
 
96
99
  -- HotUpdater.get_target_app_version_list
97
100
 
@@ -131,4 +134,4 @@ BEGIN
131
134
  END;
132
135
  $$;
133
136
 
134
- CREATE INDEX bundles_channel_idx ON bundles(channel);
137
+ CREATE INDEX IF NOT EXISTS bundles_channel_idx ON bundles(channel);
@@ -8,14 +8,26 @@ UPDATE bundles
8
8
  SET storage_uri = 'supabase-storage://%%BUCKET_NAME%%/' || id || '/bundle.zip'
9
9
  WHERE storage_uri IS NULL;
10
10
 
11
- ALTER TABLE bundles ALTER COLUMN storage_uri SET NOT NULL;
12
- ALTER TABLE bundles ALTER COLUMN target_app_version DROP NOT NULL;
11
+ DO $$ BEGIN
12
+ ALTER TABLE bundles ALTER COLUMN storage_uri SET NOT NULL;
13
+ EXCEPTION
14
+ WHEN null_value_not_allowed THEN NULL;
15
+ END $$;
16
+ DO $$ BEGIN
17
+ ALTER TABLE bundles ALTER COLUMN target_app_version DROP NOT NULL;
18
+ EXCEPTION
19
+ WHEN null_value_not_allowed THEN NULL;
20
+ END $$;
13
21
 
14
- ALTER TABLE bundles ADD CONSTRAINT check_version_or_fingerprint CHECK (
15
- (target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
16
- );
22
+ DO $$ BEGIN
23
+ ALTER TABLE bundles ADD CONSTRAINT check_version_or_fingerprint CHECK (
24
+ (target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL)
25
+ );
26
+ EXCEPTION
27
+ WHEN duplicate_object THEN NULL;
28
+ END $$;
17
29
 
18
- CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
30
+ CREATE INDEX IF NOT EXISTS bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
19
31
 
20
32
  DROP FUNCTION IF EXISTS get_update_info;
21
33
 
@@ -1,5 +1,7 @@
1
- DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
2
- DROP FUNCTION IF EXISTS get_update_info_by_app_version;
1
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
2
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
3
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
4
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
3
5
 
4
6
  -- HotUpdater.get_update_info
5
7
  CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
@@ -251,7 +251,8 @@ $$;
251
251
 
252
252
  -- HotUpdater.get_update_info_by_fingerprint_hash
253
253
 
254
- DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash;
254
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
255
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_fingerprint_hash(platforms, uuid, uuid, text, text, text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
255
256
 
256
257
  CREATE OR REPLACE FUNCTION get_update_info_by_fingerprint_hash (
257
258
  app_platform platforms,
@@ -377,7 +378,8 @@ $$;
377
378
 
378
379
  -- HotUpdater.get_update_info_by_app_version
379
380
 
380
- DROP FUNCTION IF EXISTS get_update_info_by_app_version;
381
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[]); EXCEPTION WHEN undefined_function THEN NULL; END $$;
382
+ DO $$ BEGIN DROP FUNCTION IF EXISTS get_update_info_by_app_version(platforms, text, uuid, uuid, text, text[], text); EXCEPTION WHEN undefined_function THEN NULL; END $$;
381
383
 
382
384
  CREATE OR REPLACE FUNCTION get_update_info_by_app_version (
383
385
  app_platform platforms,
@@ -1,7 +1,11 @@
1
1
  -- HotUpdater.supabase_rls
2
2
 
3
3
  ALTER TABLE public.bundles ENABLE ROW LEVEL SECURITY;
4
- ALTER TABLE public.bundle_patches ENABLE ROW LEVEL SECURITY;
4
+ DO $$ BEGIN
5
+ ALTER TABLE public.bundle_patches ENABLE ROW LEVEL SECURITY;
6
+ EXCEPTION
7
+ WHEN undefined_table THEN NULL;
8
+ END $$;
5
9
 
6
10
  ALTER FUNCTION public.get_target_app_version_list(public.platforms, uuid)
7
11
  SET search_path = public, pg_catalog;
@@ -50,10 +54,22 @@ ALTER FUNCTION public.get_update_info_by_app_version(
50
54
  -- OTA update checks are unauthenticated by design (the device only carries the
51
55
  -- anon key), so bundle metadata must be publicly readable. hot-updater's hosted
52
56
  -- Supabase flow relies on these policies existing.
53
- CREATE POLICY "allow public read bundles" ON public.bundles FOR SELECT USING (true);
54
- CREATE POLICY "allow public read bundle_patches" ON public.bundle_patches FOR SELECT USING (true);
57
+ DO $$ BEGIN
58
+ CREATE POLICY "allow public read bundles" ON public.bundles FOR SELECT USING (true);
59
+ EXCEPTION
60
+ WHEN duplicate_object THEN NULL;
61
+ END $$;
62
+ DO $$ BEGIN
63
+ CREATE POLICY "allow public read bundle_patches" ON public.bundle_patches FOR SELECT USING (true);
64
+ EXCEPTION
65
+ WHEN duplicate_object THEN NULL;
66
+ END $$;
55
67
 
56
68
  -- Allow anon/authenticated to resolve signed download URLs for the bundles bucket.
57
- CREATE POLICY "public bundles read" ON storage.objects
58
- FOR SELECT TO anon, authenticated
59
- USING (bucket_id = 'bundles');
69
+ DO $$ BEGIN
70
+ CREATE POLICY "public bundles read" ON storage.objects
71
+ FOR SELECT TO anon, authenticated
72
+ USING (bucket_id = 'bundles');
73
+ EXCEPTION
74
+ WHEN duplicate_object THEN NULL;
75
+ END $$;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_nazmiforreal/flutter-ota",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Command-line interface for flutter_ota_kit — an OTA code-push tool for Flutter, hot-updater compatible.",
5
5
  "bin": {
6
6
  "flutter-ota": "./bin/flutter-ota.js"
package/scripts/vendor.sh CHANGED
@@ -26,4 +26,36 @@ find "$DST" -name build -type d -prune -exec rm -rf {} +
26
26
  find "$DST" -name .git -type d -prune -exec rm -rf {} +
27
27
  find "$DST" -name coverage -type d -prune -exec rm -rf {} +
28
28
 
29
+ # Sync migration SQL files so the binary can find them at ../migrations/<backend>/
30
+ MIG_DST="$(cd "$(dirname "$0")/.." && pwd)/migrations"
31
+ rm -rf "$MIG_DST"
32
+
33
+ # Supabase: migrations live in plugins/supabase/supabase/migrations/
34
+ if [ -d "$SRC/plugins/supabase/supabase/migrations" ]; then
35
+ mkdir -p "$MIG_DST/supabase"
36
+ cp "$SRC/plugins/supabase/supabase/migrations"/*.sql "$MIG_DST/supabase/"
37
+ echo " synced migrations/supabase ($(ls "$MIG_DST/supabase/"*.sql | wc -l) files)"
38
+ fi
39
+
40
+ # Postgres: SQL lives in plugins/postgres/sql/
41
+ if [ -d "$SRC/plugins/postgres/sql" ]; then
42
+ mkdir -p "$MIG_DST/postgres"
43
+ cp "$SRC/plugins/postgres/sql"/*.sql "$MIG_DST/postgres/"
44
+ echo " synced migrations/postgres ($(ls "$MIG_DST/postgres/"*.sql | wc -l) files)"
45
+ fi
46
+
47
+ # Cloudflare: migrations live in plugins/cloudflare/migrations/
48
+ if [ -d "$SRC/plugins/cloudflare/migrations" ]; then
49
+ mkdir -p "$MIG_DST/cloudflare"
50
+ cp "$SRC/plugins/cloudflare/migrations"/*.sql "$MIG_DST/cloudflare/"
51
+ echo " synced migrations/cloudflare ($(ls "$MIG_DST/cloudflare/"*.sql | wc -l) files)"
52
+ fi
53
+
54
+ # AWS: migrations live in plugins/aws/migrations/ (if any)
55
+ if [ -d "$SRC/plugins/aws/migrations" ]; then
56
+ mkdir -p "$MIG_DST/aws"
57
+ cp "$SRC/plugins/aws/migrations"/*.sql "$MIG_DST/aws/"
58
+ echo " synced migrations/aws ($(ls "$MIG_DST/aws/"*.sql | wc -l) files)"
59
+ fi
60
+
29
61
  echo "Done. dart-src size: $(du -sh "$DST" | cut -f1)"
@@ -1,7 +0,0 @@
1
- # AWS migrations
2
-
3
- The AWS backend stores bundle metadata as JSON in S3 (blob database), not in a
4
- relational database. There are **no SQL migrations** to apply — the bucket and
5
- object prefix are created on first `deploy`.
6
-
7
- If you front downloads with CloudFront, provision the distribution separately.
@@ -1,42 +0,0 @@
1
- -- HotUpdater.bundles
2
-
3
- CREATE TABLE bundles (
4
- id TEXT PRIMARY KEY,
5
- platform TEXT NOT NULL CHECK (platform IN ('ios', 'android')),
6
- target_app_version TEXT,
7
- should_force_update INTEGER NOT NULL CHECK (should_force_update IN (0, 1)),
8
- enabled INTEGER NOT NULL CHECK (enabled IN (0, 1)),
9
- file_hash TEXT NOT NULL,
10
- git_commit_hash TEXT,
11
- message TEXT,
12
- channel TEXT NOT NULL DEFAULT 'production',
13
- storage_uri TEXT NOT NULL,
14
- fingerprint_hash TEXT,
15
- metadata JSONB DEFAULT '{}',
16
- manifest_storage_uri TEXT,
17
- manifest_file_hash TEXT,
18
- asset_base_storage_uri TEXT,
19
- rollout_cohort_count INTEGER DEFAULT 1000
20
- CHECK (rollout_cohort_count >= 0 AND rollout_cohort_count <= 1000),
21
- target_cohorts TEXT,
22
- CHECK ((target_app_version IS NOT NULL) OR (fingerprint_hash IS NOT NULL))
23
- );
24
-
25
- CREATE TABLE bundle_patches (
26
- id TEXT PRIMARY KEY,
27
- bundle_id TEXT NOT NULL,
28
- base_bundle_id TEXT NOT NULL,
29
- base_file_hash TEXT NOT NULL,
30
- patch_file_hash TEXT NOT NULL,
31
- patch_storage_uri TEXT NOT NULL,
32
- order_index INTEGER NOT NULL DEFAULT 0,
33
- FOREIGN KEY (bundle_id) REFERENCES bundles(id) ON DELETE CASCADE,
34
- FOREIGN KEY (base_bundle_id) REFERENCES bundles(id) ON DELETE CASCADE
35
- );
36
-
37
- CREATE INDEX bundles_target_app_version_idx ON bundles(target_app_version);
38
- CREATE INDEX bundles_fingerprint_hash_idx ON bundles(fingerprint_hash);
39
- CREATE INDEX bundles_channel_idx ON bundles(channel);
40
- CREATE INDEX bundles_rollout_idx ON bundles(rollout_cohort_count);
41
- CREATE INDEX bundle_patches_bundle_id_idx ON bundle_patches(bundle_id);
42
- CREATE INDEX bundle_patches_base_bundle_id_idx ON bundle_patches(base_bundle_id);