surrealdb-core 3.2.0

A scalable, distributed, collaborative, document-graph database, for the realtime web
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
//! Catalog backwards compatibility tests.
//!
//! These tests verify that:
//! 1. Serialized data from previous versions can be deserialized
//! 2. The deserialized values EXACTLY match the expected fixtures
//!
//! Failing either check indicates a backwards compatibility regression.

use super::super::*;
use super::{fixtures, v3_0_0, v3_0_0_beta_1, v3_0_0_beta_3, v3_1_0, v3_1_1};
use crate::cf::TableMutations;
use crate::dbs::node::Node;
use crate::idx::ft::fulltext::{DocLengthAndCount, TermDocument};
use crate::kvs::KVValue;
use crate::kvs::index::{Appending, PrimaryAppending};
use crate::kvs::sequences::{BatchValue, SequenceState};
use crate::kvs::tasklease::TaskLease;
use crate::kvs::version::MajorVersion;
use crate::val::{RecordId, RecordIdKey};

/// Returns `true` for version snapshots captured under the **current**
/// write format — the latest revision the encoder emits.
///
/// [`compat_test!`] uses this to gate a stricter byte-exact round-trip
/// assertion: if the encoder produces different bytes than the frozen
/// fixture, the test fails with a "WIRE STABILITY BROKEN" message. This
/// guarantees that encoder drift (e.g. an upstream `revision` crate
/// format shift) is caught immediately rather than discovered when an
/// older binary tries to read newer data.
///
/// Historical snapshots (`v3_0_0_*`, and now `v3_1_0`) were captured
/// under an earlier encoder; the current encoder produces different
/// bytes for some of their fixtures, so a byte-match comparison would
/// fail spuriously for them. They keep their decode-and-equals assertion
/// only.
///
/// `v3_1_0` was demoted from current-format when 3.1.1 stopped stripping
/// the top-level `id` from `Record` data: the decoder still reads 3.1.0's
/// id-stripped `RECORD_OBJECT` / `RECORD_WITH_METADATA` /
/// `RECORD_WITH_TABLE_METADATA` fixtures (splicing the id from the key),
/// but the encoder now writes the id inline, so re-encoding no longer
/// reproduces the frozen 3.1.0 bytes.
///
/// When the write format advances again, capture a new `vX_Y_Z` snapshot
/// and move the tag here.
const fn version_writes_current_format(version_name: &str) -> bool {
	// Constant-folded at compile time per macro expansion via
	// `stringify!`. Compared as bytes so the match is `const`-eligible.
	matches!(version_name.as_bytes(), b"v3_1_1")
}

/// Macro to generate backwards compatibility tests for a fixture across multiple versions.
///
/// Decode goes through the real `KVValue::kv_decode_value` path so the
/// test exercises the same code production uses. Two arms:
/// * 5-arg form (default): for value types whose `KeyContext = ()`.
/// * 6-arg form (with `ctx`): for `Record`, whose decode splices the `RecordId` argument into the
///   resulting `data` Object. Pass `fixtures::test_record_rid()` for those; Object-data Record
///   fixtures are built to include the same rid as their `id` field so the decode/expected
///   comparison lines up.
macro_rules! compat_test {
	// 5-arg form: KeyContext = () (default context).
	($base_name:ident, $type:ty, $const_name:ident, $expected:expr, [$($version:ident),+ $(,)?]) => {
		compat_test!(@inner $base_name, $type, $const_name, $expected, (), [$($version),+]);
	};
	// 6-arg form: explicit context (for `Record`, with `RecordId`).
	($base_name:ident, $type:ty, $const_name:ident, $expected:expr, $ctx:expr, [$($version:ident),+ $(,)?]) => {
		compat_test!(@inner $base_name, $type, $const_name, $expected, $ctx, [$($version),+]);
	};
	// Internal generator.
	(@inner $base_name:ident, $type:ty, $const_name:ident, $expected:expr, $ctx:expr, [$($version:ident),+ $(,)?]) => {
		$(
			paste::paste! {
				#[test]
				fn [<$version _ $base_name>]() {
					let fixture_bytes = [<$version>]::$const_name;

					// Attempt to decode - this MUST succeed for backwards compatibility
					let decoded = <$type>::kv_decode_value(fixture_bytes, $ctx).unwrap_or_else(|e| {
						panic!(
							concat!(
								"BACKWARDS COMPATIBILITY BROKEN: Failed to decode ",
								stringify!([<$version _ $base_name>]),
								" fixture.\n",
								"Type: ",
								stringify!($type),
								"\n",
								"Error: {}\n",
								"Bytes: {:?}\n\n",
								"This indicates that the serialization format has changed in an ",
								"incompatible way. Old databases may fail to load.\n",
								"If this change is intentional, you MUST implement a migration path."
							),
							e, fixture_bytes
						)
					});

					// Get the expected value from fixtures
					let expected = $expected;

					// Assert that the decoded value matches the expected fixture
					assert_eq!(
						decoded, expected,
						concat!(
							"BACKWARDS COMPATIBILITY BROKEN: Decoded value does not match expected ",
							"fixture for ",
							stringify!([<$version _ $base_name>]),
							".\n\n",
							"This indicates that while deserialization succeeded, the data was ",
							"interpreted differently than expected. This could cause data corruption ",
							"or unexpected behavior when loading old databases.\n\n",
							"If this change is intentional, update the fixture in fixtures.rs to ",
							"reflect how old data should be interpreted by the current code."
						)
					);

					// Verify re-encoding succeeds. For historical snapshots the
					// re-encoded bytes may differ from the input because the
					// encoder now writes the latest revision, but for fixtures
					// captured under the current write format
					// (see `version_writes_current_format`) we tighten this to
					// a byte-exact assertion.
					let re_encoded = decoded.kv_encode_value().unwrap_or_else(|e| {
						panic!(
							concat!(
								"Failed to re-encode ",
								stringify!([<$version _ $base_name>]),
								" after successful decode.\n",
								"Error: {}"
							),
							e
						)
					});

					if version_writes_current_format(stringify!($version)) {
						assert_eq!(
							re_encoded.as_slice(),
							fixture_bytes,
							concat!(
								"WIRE STABILITY BROKEN: re-encoded bytes do not match the frozen ",
								stringify!([<$version _ $base_name>]),
								" fixture.\n\n",
								"The encoder is producing different bytes for the same value than ",
								"what was captured under this version. If the change is intentional ",
								"(e.g. revision crate format shift), capture a NEW version snapshot ",
								"rather than mutating this one — the frozen file at ",
								stringify!($version),
								".rs must NEVER be modified after commit."
							)
						);
					}
				}
			}
		)+
	};
}

// =============================================================================
// Backwards Compatibility Tests
// =============================================================================

// NamespaceDefinition
compat_test!(
	namespace_basic,
	NamespaceDefinition,
	NAMESPACE_BASIC,
	fixtures::namespace_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	namespace_with_comment,
	NamespaceDefinition,
	NAMESPACE_WITH_COMMENT,
	fixtures::namespace_with_comment(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// DatabaseDefinition
compat_test!(
	database_basic,
	DatabaseDefinition,
	DATABASE_BASIC,
	fixtures::database_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	database_with_changefeed,
	DatabaseDefinition,
	DATABASE_WITH_CHANGEFEED,
	fixtures::database_with_changefeed(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	database_strict,
	DatabaseDefinition,
	DATABASE_STRICT,
	fixtures::database_strict(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// TableDefinition
compat_test!(
	table_basic,
	TableDefinition,
	TABLE_BASIC,
	fixtures::table_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_with_view,
	TableDefinition,
	TABLE_WITH_VIEW,
	fixtures::table_with_view(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_schemafull,
	TableDefinition,
	TABLE_SCHEMAFULL,
	fixtures::table_schemafull(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_relation,
	TableDefinition,
	TABLE_RELATION,
	fixtures::table_relation(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_with_materialized_view,
	TableDefinition,
	TABLE_WITH_MATERIALIZED_VIEW,
	fixtures::table_with_materialized_view(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_any_type,
	TableDefinition,
	TABLE_ANY_TYPE,
	fixtures::table_any_type(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// SubscriptionDefinition
compat_test!(
	subscription_basic,
	SubscriptionDefinition,
	SUBSCRIPTION_BASIC,
	fixtures::subscription_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	subscription_with_filters,
	SubscriptionDefinition,
	SUBSCRIPTION_WITH_FILTERS,
	fixtures::subscription_with_filters(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	subscription_with_vars,
	SubscriptionDefinition,
	SUBSCRIPTION_WITH_VARS,
	fixtures::subscription_with_vars(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// AccessDefinition
compat_test!(
	access_bearer,
	AccessDefinition,
	ACCESS_BEARER,
	fixtures::access_bearer(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	access_with_authenticate,
	AccessDefinition,
	ACCESS_WITH_AUTHENTICATE,
	fixtures::access_with_authenticate(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	access_record,
	AccessDefinition,
	ACCESS_RECORD,
	fixtures::access_record(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	access_jwt_jwks,
	AccessDefinition,
	ACCESS_JWT_JWKS,
	fixtures::access_jwt_jwks(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	access_bearer_refresh,
	AccessDefinition,
	ACCESS_BEARER_REFRESH,
	fixtures::access_bearer_refresh(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// AccessGrant
compat_test!(
	grant_jwt,
	AccessGrant,
	GRANT_JWT,
	fixtures::grant_jwt(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	grant_revoked,
	AccessGrant,
	GRANT_REVOKED,
	fixtures::grant_revoked(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	grant_record,
	AccessGrant,
	GRANT_RECORD,
	fixtures::grant_record(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	grant_bearer,
	AccessGrant,
	GRANT_BEARER,
	fixtures::grant_bearer(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// AnalyzerDefinition
compat_test!(
	analyzer_basic,
	AnalyzerDefinition,
	ANALYZER_BASIC,
	fixtures::analyzer_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	analyzer_with_tokenizers,
	AnalyzerDefinition,
	ANALYZER_WITH_TOKENIZERS,
	fixtures::analyzer_with_tokenizers(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// ApiDefinition
compat_test!(
	api_basic,
	ApiDefinition,
	API_BASIC,
	fixtures::api_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	api_with_middleware,
	ApiDefinition,
	API_WITH_MIDDLEWARE,
	fixtures::api_with_middleware(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	api_with_auth_limit,
	ApiDefinition,
	API_WITH_AUTH_LIMIT,
	fixtures::api_with_auth_limit(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// BucketDefinition
compat_test!(
	bucket_basic,
	BucketDefinition,
	BUCKET_BASIC,
	fixtures::bucket_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	bucket_readonly,
	BucketDefinition,
	BUCKET_READONLY,
	fixtures::bucket_readonly(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// ConfigDefinition
compat_test!(
	config_graphql,
	ConfigDefinition,
	CONFIG_GRAPHQL,
	fixtures::config_graphql(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	config_default,
	ConfigDefinition,
	CONFIG_DEFAULT,
	fixtures::config_default(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	config_api,
	ConfigDefinition,
	CONFIG_API,
	fixtures::config_api(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	config_graphql_full,
	ConfigDefinition,
	CONFIG_GRAPHQL_FULL,
	fixtures::config_graphql_full(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// EventDefinition
compat_test!(
	event_basic,
	EventDefinition,
	EVENT_BASIC,
	fixtures::event_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	event_async,
	EventDefinition,
	EVENT_ASYNC,
	fixtures::event_async(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// FieldDefinition
compat_test!(
	field_basic,
	FieldDefinition,
	FIELD_BASIC,
	fixtures::field_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	field_with_type,
	FieldDefinition,
	FIELD_WITH_TYPE,
	fixtures::field_with_type(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	field_readonly,
	FieldDefinition,
	FIELD_READONLY,
	fixtures::field_readonly(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	field_flexible_with_reference,
	FieldDefinition,
	FIELD_FLEXIBLE_WITH_REFERENCE,
	fixtures::field_flexible_with_reference(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	field_with_default_set,
	FieldDefinition,
	FIELD_WITH_DEFAULT_SET,
	fixtures::field_with_default_set(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	field_record_type,
	FieldDefinition,
	FIELD_RECORD_TYPE,
	fixtures::field_record_type(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// FunctionDefinition
compat_test!(
	function_basic,
	FunctionDefinition,
	FUNCTION_BASIC,
	fixtures::function_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	function_with_args,
	FunctionDefinition,
	FUNCTION_WITH_ARGS,
	fixtures::function_with_args(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// IndexDefinition
compat_test!(
	index_basic,
	IndexDefinition,
	INDEX_BASIC,
	fixtures::index_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	index_unique,
	IndexDefinition,
	INDEX_UNIQUE,
	fixtures::index_unique(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	index_hnsw,
	IndexDefinition,
	INDEX_HNSW,
	fixtures::index_hnsw(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	index_fulltext,
	IndexDefinition,
	INDEX_FULLTEXT,
	fixtures::index_fulltext(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	index_count,
	IndexDefinition,
	INDEX_COUNT,
	fixtures::index_count(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// MlModelDefinition
compat_test!(
	model_basic,
	MlModelDefinition,
	MODEL_BASIC,
	fixtures::model_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// ParamDefinition
compat_test!(
	param_bool,
	ParamDefinition,
	PARAM_BOOL,
	fixtures::param_bool(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	param_string,
	ParamDefinition,
	PARAM_STRING,
	fixtures::param_string(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// SequenceDefinition
compat_test!(
	sequence_basic,
	SequenceDefinition,
	SEQUENCE_BASIC,
	fixtures::sequence_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	sequence_with_options,
	SequenceDefinition,
	SEQUENCE_WITH_OPTIONS,
	fixtures::sequence_with_options(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// UserDefinition
compat_test!(
	user_basic,
	UserDefinition,
	USER_BASIC,
	fixtures::user_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	user_with_durations,
	UserDefinition,
	USER_WITH_DURATIONS,
	fixtures::user_with_durations(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	user_db_base,
	UserDefinition,
	USER_DB_BASE,
	fixtures::user_db_base(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// Record
compat_test!(
	record_none,
	Record,
	RECORD_NONE,
	fixtures::record_none(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_null,
	Record,
	RECORD_NULL,
	fixtures::record_null(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_bool,
	Record,
	RECORD_BOOL,
	fixtures::record_bool(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_number_int,
	Record,
	RECORD_NUMBER_INT,
	fixtures::record_number_int(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_number_float,
	Record,
	RECORD_NUMBER_FLOAT,
	fixtures::record_number_float(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_number_decimal,
	Record,
	RECORD_NUMBER_DECIMAL,
	fixtures::record_number_decimal(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_string,
	Record,
	RECORD_STRING,
	fixtures::record_string(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_bytes,
	Record,
	RECORD_BYTES,
	fixtures::record_bytes(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_duration,
	Record,
	RECORD_DURATION,
	fixtures::record_duration(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_datetime,
	Record,
	RECORD_DATETIME,
	fixtures::record_datetime(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_uuid,
	Record,
	RECORD_UUID,
	fixtures::record_uuid(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_point,
	Record,
	RECORD_GEOMETRY_POINT,
	fixtures::record_geometry_point(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_line,
	Record,
	RECORD_GEOMETRY_LINE,
	fixtures::record_geometry_line(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_polygon,
	Record,
	RECORD_GEOMETRY_POLYGON,
	fixtures::record_geometry_polygon(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_multi_point,
	Record,
	RECORD_GEOMETRY_MULTI_POINT,
	fixtures::record_geometry_multi_point(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_multi_line,
	Record,
	RECORD_GEOMETRY_MULTI_LINE,
	fixtures::record_geometry_multi_line(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_multi_polygon,
	Record,
	RECORD_GEOMETRY_MULTI_POLYGON,
	fixtures::record_geometry_multi_polygon(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_geometry_collection,
	Record,
	RECORD_GEOMETRY_COLLECTION,
	fixtures::record_geometry_collection(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_table,
	Record,
	RECORD_TABLE,
	fixtures::record_table(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_recordid,
	Record,
	RECORD_RECORDID,
	fixtures::record_recordid(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_file,
	Record,
	RECORD_FILE,
	fixtures::record_file(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_range_unbounded,
	Record,
	RECORD_RANGE_UNBOUNDED,
	fixtures::record_range_unbounded(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_range_bounded,
	Record,
	RECORD_RANGE_BOUNDED,
	fixtures::record_range_bounded(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_regex,
	Record,
	RECORD_REGEX,
	fixtures::record_regex(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_array,
	Record,
	RECORD_ARRAY,
	fixtures::record_array(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_object,
	Record,
	RECORD_OBJECT,
	fixtures::record_object(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_set,
	Record,
	RECORD_SET,
	fixtures::record_set(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_with_metadata,
	Record,
	RECORD_WITH_METADATA,
	fixtures::record_with_metadata(),
	fixtures::test_record_rid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	record_with_table_metadata,
	Record,
	RECORD_WITH_TABLE_METADATA,
	fixtures::record_with_table_metadata(),
	fixtures::test_record_rid(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// MajorVersion
compat_test!(
	version_1,
	MajorVersion,
	VERSION_1,
	fixtures::version_1(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	version_3,
	MajorVersion,
	VERSION_3,
	fixtures::version_3(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// ApiActionDefinition
compat_test!(
	api_action_basic,
	ApiActionDefinition,
	API_ACTION_BASIC,
	fixtures::api_action_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	api_action_multi_method,
	ApiActionDefinition,
	API_ACTION_MULTI_METHOD,
	fixtures::api_action_multi_method(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// Appending
compat_test!(
	appending_none,
	Appending,
	APPENDING_NONE,
	fixtures::appending_none(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	appending_old_values,
	Appending,
	APPENDING_OLD_VALUES,
	fixtures::appending_old_values(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	appending_new_values,
	Appending,
	APPENDING_NEW_VALUES,
	fixtures::appending_new_values(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	appending_both,
	Appending,
	APPENDING_BOTH,
	fixtures::appending_both(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// DocLengthAndCount
compat_test!(
	doc_length_and_count_basic,
	DocLengthAndCount,
	DOC_LENGTH_AND_COUNT_BASIC,
	fixtures::doc_length_and_count_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// PrimaryAppending
compat_test!(
	primary_appending_basic,
	PrimaryAppending,
	PRIMARY_APPENDING_BASIC,
	fixtures::primary_appending_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// BatchValue
compat_test!(
	batch_value_basic,
	BatchValue,
	BATCH_VALUE_BASIC,
	fixtures::batch_value_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// SequenceState
compat_test!(
	sequence_state_basic,
	SequenceState,
	SEQUENCE_STATE_BASIC,
	fixtures::sequence_state_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// TaskLease
compat_test!(
	task_lease_basic,
	TaskLease,
	TASK_LEASE_BASIC,
	fixtures::task_lease_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// IDs
compat_test!(
	namespace_id_basic,
	NamespaceId,
	NAMESPACE_ID_BASIC,
	fixtures::namespace_id_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	database_id_basic,
	DatabaseId,
	DATABASE_ID_BASIC,
	fixtures::database_id_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_id_basic,
	TableId,
	TABLE_ID_BASIC,
	fixtures::table_id_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	index_id_basic,
	IndexId,
	INDEX_ID_BASIC,
	fixtures::index_id_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// ModuleDefinition
compat_test!(
	module_definition_surrealism,
	ModuleDefinition,
	MODULE_SURREALISM,
	fixtures::module_surrealism(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	module_definition_silo,
	ModuleDefinition,
	MODULE_SILO,
	fixtures::module_silo(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	module_no_name,
	ModuleDefinition,
	MODULE_NO_NAME,
	fixtures::module_no_name(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// NodeLiveQuery
compat_test!(
	node_live_query_basic,
	NodeLiveQuery,
	NODE_LIVE_QUERY_BASIC,
	fixtures::node_live_query_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// TableMutations
compat_test!(
	table_mutations_set,
	TableMutations,
	TABLE_MUTATIONS_SET,
	fixtures::table_mutations_set(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_mutations_del,
	TableMutations,
	TABLE_MUTATIONS_DEL,
	fixtures::table_mutations_del(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_mutations_def,
	TableMutations,
	TABLE_MUTATIONS_DEF,
	fixtures::table_mutations_def(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_mutations_set_with_diff,
	TableMutations,
	TABLE_MUTATIONS_SET_WITH_DIFF,
	fixtures::table_mutations_set_with_diff(),
	[v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	table_mutations_del_with_original,
	TableMutations,
	TABLE_MUTATIONS_DEL_WITH_ORIGINAL,
	fixtures::table_mutations_del_with_original(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// Node
compat_test!(
	node_active,
	Node,
	NODE_ACTIVE,
	fixtures::node_active(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	node_archived,
	Node,
	NODE_ARCHIVED,
	fixtures::node_archived(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// RecordId
compat_test!(
	recordid_number,
	RecordId,
	RECORDID_NUMBER,
	fixtures::recordid_number(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_string,
	RecordId,
	RECORDID_STRING,
	fixtures::recordid_string(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_uuid,
	RecordId,
	RECORDID_UUID,
	fixtures::recordid_uuid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);

// RecordIdKey
compat_test!(
	recordid_key_number,
	RecordIdKey,
	RECORDID_KEY_NUMBER,
	fixtures::recordid_key_number(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_key_string,
	RecordIdKey,
	RECORDID_KEY_STRING,
	fixtures::recordid_key_string(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_key_uuid,
	RecordIdKey,
	RECORDID_KEY_UUID,
	fixtures::recordid_key_uuid(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_key_array,
	RecordIdKey,
	RECORDID_KEY_ARRAY,
	fixtures::recordid_key_array(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_key_object,
	RecordIdKey,
	RECORDID_KEY_OBJECT,
	fixtures::recordid_key_object(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);
compat_test!(
	recordid_key_range,
	RecordIdKey,
	RECORDID_KEY_RANGE,
	fixtures::recordid_key_range(),
	[v3_0_0, v3_1_0, v3_1_1]
);

// TermDocument
compat_test!(
	term_document_basic,
	TermDocument,
	TERM_DOCUMENT_BASIC,
	fixtures::term_document_basic(),
	[v3_0_0_beta_1, v3_0_0_beta_3, v3_0_0, v3_1_0, v3_1_1]
);