Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: auto populate old records for new field with default value #3662

Open
2 tasks done
agufagit opened this issue Mar 9, 2024 · 1 comment
Open
2 tasks done
Labels
feature New feature or request triage This issue is new

Comments

@agufagit
Copy link

agufagit commented Mar 9, 2024

Is your feature request related to a problem?

old records are not automatically populated when a new field is defined with default value, and it throws error when trying to update that table

DEFINE TABLE t SCHEMAFULL;
DEFINE FIELD i ON TABLE t TYPE int;
CREATE t:1 SET i = 1;

DEFINE FIELD j ON TABLE t TYPE string DEFAULT '1';
UPDATE t:1 SET i = 2;

Found NONE for field `j`, with record `t:1`, but expected a string

Describe the solution

auto populate old record with new field default avlue

Alternative methods

manually update old records with new field default value

SurrealDB version

surreal 1.2.1

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@agufagit agufagit added feature New feature or request triage This issue is new labels Mar 9, 2024
@JABirchall
Copy link

JABirchall commented Apr 18, 2024

I recently ran into this issue today, Editted a table to add a column, set the default value because the column might not filled in when inserting new records.

Tried updating a record and it is refusing to because the culumn is None.

Found NONE for field properties, with record nodes:mrcclik8icnni7cfhkrw, but expected a array

I dont expect this behavour for a column which has a default value set.

Version 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request triage This issue is new
Projects
None yet
Development

No branches or pull requests

2 participants