Skip to content

Commit 15a297d

Browse files
committed
[readme] updated instruction for existing table
1 parent eafd743 commit 15a297d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Metric(TimescaleModel):
7979

8080
```
8181

82-
If you already have a table and want to just add a field you can add the TimescaleDateTimeField to your model. This also triggers the creation of a hypertable.
82+
If you already have a table, you can either add `time` field of type `TimescaleDateTimeField` to your model or rename (if not already named `time`) and change type of existing `DateTimeField` (rename first then run `makemigrations` and then change the type, so that `makemigration` considers it as change in same field instead of removing and adding new field). This also triggers the creation of a hypertable.
8383

8484
```python
8585
from timescale.db.models.fields import TimescaleDateTimeField
@@ -153,4 +153,5 @@ As such the use of the Django's ORM is perfectally suited to this type of data.
153153
## Contributors
154154

155155
* [Ben Cleary](https://github.com/bencleary)
156-
* [Jonathan Sundqvist](https://github.com/jonathan-s)
156+
* [Jonathan Sundqvist](https://github.com/jonathan-s)
157+
* [Harsh Bhikadia](https://github.com/daadu)

README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,14 @@ Implementation would look like this
7777
temperature = models.FloatField()
7878
7979
80-
If you already have a table and want to just add a field you can add the
81-
TimescaleDateTimeField to your model. This also triggers the creation of
82-
a hypertable.
80+
If you already have a table, you can either add `time`
81+
field of type `TimescaleDateTimeField` to your model or
82+
rename (if not already named `time`) and change type of
83+
existing `DateTimeField` (rename first then run
84+
`makemigrations` and then change the type, so that
85+
`makemigration` considers it as change in same field
86+
instead of removing and adding new field). This also
87+
triggers the creation of a hypertable.
8388

8489
.. code:: python
8590

0 commit comments

Comments
 (0)