prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Split payments shares <1%
  Trying to set a payment share <1% will result in 500 INTERNAL SERVER ERROR.
  This should work as it would be very useful as a fee for hosting lnbits but 1% is too much.
  ![grafik](https://user-images.githubusercontent.com/51097237/174864872-55ed946c-ce0a-4dc6-8c90-ec2e70c29f54.png)
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lnbits/extensions/splitpayments/migrations.py`
  Content:
  ```
  1 async def m001_initial(db):
  2     """
  3     Initial split payment table.
  4     """
  5     await db.execute(
  6         """
  7         CREATE TABLE splitpayments.targets (
  8             wallet TEXT NOT NULL,
  9             source TEXT NOT NULL,
  10             percent INTEGER NOT NULL CHECK (percent >= 0 AND percent <= 100),
  11             alias TEXT,
  12 
  13             UNIQUE (source, wallet)
  14         );
  15         """
  16     )
  17
  ```
  
  Path: `lnbits/extensions/splitpayments/models.py`
  Content:
  ```
  1 from typing import List, Optional
  2 
  3 from fastapi.param_functions import Query
  4 from pydantic import BaseModel
  5 
  6 
  7 class Target(BaseModel):
  8     wallet: str
  9     source: str
  10     percent: int
  11     alias: Optional[str]
  12 
  13 
  14 class TargetPutList(BaseModel):
  15     wallet: str = Query(...)
  16     alias: str = Query("")
  17     percent: int = Query(..., ge=1)
  18 
  19 
  20 class TargetPut(BaseModel):
  21     __root__: List[TargetPutList]
  22
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/lnbits/extensions/splitpayments/migrations.py b/lnbits/extensions/splitpayments/migrations.py
  --- a/lnbits/extensions/splitpayments/migrations.py
  +++ b/lnbits/extensions/splitpayments/migrations.py
  @@ -14,3 +14,41 @@
           );
           """
       )
  +
  +
  +async def m002_float_percent(db):
  +    """
  +    Add float percent and migrates the existing data.
  +    """
  +    await db.execute("ALTER TABLE splitpayments.targets RENAME TO splitpayments_old")
  +    await db.execute(
  +        """
  +        CREATE TABLE splitpayments.targets (
  +            wallet TEXT NOT NULL,
  +            source TEXT NOT NULL,
  +            percent REAL NOT NULL CHECK (percent >= 0 AND percent <= 100),
  +            alias TEXT,
  +
  +            UNIQUE (source, wallet)
  +        );
  +    """
  +    )
  +
  +    for row in [
  +        list(row)
  +        for row in await db.fetchall("SELECT * FROM splitpayments.splitpayments_old")
  +    ]:
  +        await db.execute(
  +            """
  +            INSERT INTO splitpayments.targets (
  +                wallet,
  +                source,
  +                percent,
  +                alias
  +            )
  +            VALUES (?, ?, ?, ?)
  +            """,
  +            (row[0], row[1], row[2], row[3]),
  +        )
  +
  +    await db.execute("DROP TABLE splitpayments.splitpayments_old")
  diff --git a/lnbits/extensions/splitpayments/models.py b/lnbits/extensions/splitpayments/models.py
  --- a/lnbits/extensions/splitpayments/models.py
  +++ b/lnbits/extensions/splitpayments/models.py
  @@ -7,14 +7,14 @@
   class Target(BaseModel):
       wallet: str
       source: str
  -    percent: int
  +    percent: float
       alias: Optional[str]
   
   
   class TargetPutList(BaseModel):
       wallet: str = Query(...)
       alias: str = Query("")
  -    percent: int = Query(..., ge=1)
  +    percent: float = Query(..., ge=0.01)
   
   
   class TargetPut(BaseModel):
  
verification_info: {"golden_diff": "diff --git a/lnbits/extensions/splitpayments/migrations.py b/lnbits/extensions/splitpayments/migrations.py\n--- a/lnbits/extensions/splitpayments/migrations.py\n+++ b/lnbits/extensions/splitpayments/migrations.py\n@@ -14,3 +14,41 @@\n         );\n         \"\"\"\n     )\n+\n+\n+async def m002_float_percent(db):\n+    \"\"\"\n+    Add float percent and migrates the existing data.\n+    \"\"\"\n+    await db.execute(\"ALTER TABLE splitpayments.targets RENAME TO splitpayments_old\")\n+    await db.execute(\n+        \"\"\"\n+        CREATE TABLE splitpayments.targets (\n+            wallet TEXT NOT NULL,\n+            source TEXT NOT NULL,\n+            percent REAL NOT NULL CHECK (percent >= 0 AND percent <= 100),\n+            alias TEXT,\n+\n+            UNIQUE (source, wallet)\n+        );\n+    \"\"\"\n+    )\n+\n+    for row in [\n+        list(row)\n+        for row in await db.fetchall(\"SELECT * FROM splitpayments.splitpayments_old\")\n+    ]:\n+        await db.execute(\n+            \"\"\"\n+            INSERT INTO splitpayments.targets (\n+                wallet,\n+                source,\n+                percent,\n+                alias\n+            )\n+            VALUES (?, ?, ?, ?)\n+            \"\"\",\n+            (row[0], row[1], row[2], row[3]),\n+        )\n+\n+    await db.execute(\"DROP TABLE splitpayments.splitpayments_old\")\ndiff --git a/lnbits/extensions/splitpayments/models.py b/lnbits/extensions/splitpayments/models.py\n--- a/lnbits/extensions/splitpayments/models.py\n+++ b/lnbits/extensions/splitpayments/models.py\n@@ -7,14 +7,14 @@\n class Target(BaseModel):\n     wallet: str\n     source: str\n-    percent: int\n+    percent: float\n     alias: Optional[str]\n \n \n class TargetPutList(BaseModel):\n     wallet: str = Query(...)\n     alias: str = Query(\"\")\n-    percent: int = Query(..., ge=1)\n+    percent: float = Query(..., ge=0.01)\n \n \n class TargetPut(BaseModel):\n", "issue": "Split payments shares <1%\nTrying to set a payment share <1% will result in 500 INTERNAL SERVER ERROR.\r\nThis should work as it would be very useful as a fee for hosting lnbits but 1% is too much.\r\n![grafik](https://user-images.githubusercontent.com/51097237/174864872-55ed946c-ce0a-4dc6-8c90-ec2e70c29f54.png)\r\n\n", "before_files": [{"content": "async def m001_initial(db):\n    \"\"\"\n    Initial split payment table.\n    \"\"\"\n    await db.execute(\n        \"\"\"\n        CREATE TABLE splitpayments.targets (\n            wallet TEXT NOT NULL,\n            source TEXT NOT NULL,\n            percent INTEGER NOT NULL CHECK (percent >= 0 AND percent <= 100),\n            alias TEXT,\n\n            UNIQUE (source, wallet)\n        );\n        \"\"\"\n    )\n", "path": "lnbits/extensions/splitpayments/migrations.py"}, {"content": "from typing import List, Optional\n\nfrom fastapi.param_functions import Query\nfrom pydantic import BaseModel\n\n\nclass Target(BaseModel):\n    wallet: str\n    source: str\n    percent: int\n    alias: Optional[str]\n\n\nclass TargetPutList(BaseModel):\n    wallet: str = Query(...)\n    alias: str = Query(\"\")\n    percent: int = Query(..., ge=1)\n\n\nclass TargetPut(BaseModel):\n    __root__: List[TargetPutList]\n", "path": "lnbits/extensions/splitpayments/models.py"}], "after_files": [{"content": "async def m001_initial(db):\n    \"\"\"\n    Initial split payment table.\n    \"\"\"\n    await db.execute(\n        \"\"\"\n        CREATE TABLE splitpayments.targets (\n            wallet TEXT NOT NULL,\n            source TEXT NOT NULL,\n            percent INTEGER NOT NULL CHECK (percent >= 0 AND percent <= 100),\n            alias TEXT,\n\n            UNIQUE (source, wallet)\n        );\n        \"\"\"\n    )\n\n\nasync def m002_float_percent(db):\n    \"\"\"\n    Add float percent and migrates the existing data.\n    \"\"\"\n    await db.execute(\"ALTER TABLE splitpayments.targets RENAME TO splitpayments_old\")\n    await db.execute(\n        \"\"\"\n        CREATE TABLE splitpayments.targets (\n            wallet TEXT NOT NULL,\n            source TEXT NOT NULL,\n            percent REAL NOT NULL CHECK (percent >= 0 AND percent <= 100),\n            alias TEXT,\n\n            UNIQUE (source, wallet)\n        );\n    \"\"\"\n    )\n\n    for row in [\n        list(row)\n        for row in await db.fetchall(\"SELECT * FROM splitpayments.splitpayments_old\")\n    ]:\n        await db.execute(\n            \"\"\"\n            INSERT INTO splitpayments.targets (\n                wallet,\n                source,\n                percent,\n                alias\n            )\n            VALUES (?, ?, ?, ?)\n            \"\"\",\n            (row[0], row[1], row[2], row[3]),\n        )\n\n    await db.execute(\"DROP TABLE splitpayments.splitpayments_old\")\n", "path": "lnbits/extensions/splitpayments/migrations.py"}, {"content": "from typing import List, Optional\n\nfrom fastapi.param_functions import Query\nfrom pydantic import BaseModel\n\n\nclass Target(BaseModel):\n    wallet: str\n    source: str\n    percent: float\n    alias: Optional[str]\n\n\nclass TargetPutList(BaseModel):\n    wallet: str = Query(...)\n    alias: str = Query(\"\")\n    percent: float = Query(..., ge=0.01)\n\n\nclass TargetPut(BaseModel):\n    __root__: List[TargetPutList]\n", "path": "lnbits/extensions/splitpayments/models.py"}]}